-
Notifications
You must be signed in to change notification settings - Fork 36
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Business Rules #2924
Comments
All very important things. Thanks for doing this! |
In addition to refactoring, there may be many Uniqueness Rules enforced at a database level but not enforced in Specify. Here are the rules I have identified thus far:
The majority of these would be very easy to add as uniqueness rules, would prevent data loss from error dialogs, and give instant feed back when the field is changed that the value is violating a uniqueness rule. The hard part is scouring through the database indices to find the unique fields. |
Run blank.sql_:/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
blank.sql_: UNIQUE KEY `Role` (`Role`,`AgentID`,`AccessionID`),
blank.sql_: UNIQUE KEY `AgentID` (`AgentID`,`OrderNumber`),
blank.sql_: UNIQUE KEY `AppraisalNumber` (`AppraisalNumber`),
blank.sql_: UNIQUE KEY `ReferenceWorkID` (`ReferenceWorkID`,`AgentID`),
blank.sql_: UNIQUE KEY `Role` (`Role`,`AgentID`,`BorrowID`),
blank.sql_: UNIQUE KEY `DisciplineID` (`DisciplineID`,`UniqueIdentifier`),
blank.sql_: UNIQUE KEY `CollectionID` (`CollectionID`,`UniqueIdentifier`),
blank.sql_: UNIQUE KEY `CollectionID_2` (`CollectionID`,`CatalogNumber`),
blank.sql_: UNIQUE KEY `AgentID` (`AgentID`,`CollectingEventID`),
blank.sql_: UNIQUE KEY `Role` (`Role`,`AgentID`,`DeaccessionID`),
blank.sql_: UNIQUE KEY `ReferenceWorkID` (`ReferenceWorkID`,`DeterminationID`),
blank.sql_: UNIQUE KEY `Role` (`Role`,`AgentID`,`DisposalID`),
blank.sql_: UNIQUE KEY `AgentID` (`AgentID`,`DNASequenceID`),
blank.sql_: UNIQUE KEY `AgentID` (`AgentID`,`CollectingTripID`),
blank.sql_: UNIQUE KEY `Role` (`Role`,`GiftID`,`AgentID`),
blank.sql_: UNIQUE KEY `OrderNumber` (`OrderNumber`,`GroupID`),
blank.sql_: UNIQUE KEY `Role` (`Role`,`LoanID`,`AgentID`),
blank.sql_: UNIQUE KEY `DisciplineID` (`DisciplineID`,`UniqueIdentifier`),
blank.sql_: UNIQUE KEY `ReferenceWorkID` (`ReferenceWorkID`,`LocalityID`),
blank.sql_: UNIQUE KEY `AgentID` (`AgentID`,`DNASequenceID`),
blank.sql_: UNIQUE KEY `CollectionMemberID` (`CollectionMemberID`,`BarCode`),
blank.sql_: UNIQUE KEY `Name` (`Name`),
blank.sql_:/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; |
not as helpful without table names, but you can probably open a database dump in an editor and search for also, maybe there is a way to detect in Python whether a database field is unique? |
I have a SQL script which lists the table names index names, and columns on which to enforce uniqueness, so the hard part is mostly done. Yes, there is probably a way in Python to detect unique/indexed fields. The best place to look for this might be in The schema XML does have an attribute for each field stating whether it is unique or not, but I don't think it provides information on what the field should be unique in. Does it? |
Here are a list of all Unique keys in the Specify7 database: (Note that there may be some discrepancies between databases, as discovered in #2886 (comment))
Here is the SQL script:
|
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Priorities
After the Priorities have been addressed, any of the following issues (in no particular order) should be considered for fixing, organized by Frontend/Backend/Both:
Frontend
Backend
Both
BusinessRuleException
when deleting and re-adding a collector with the same agent #2980IntegrityError
thrown, blamingcollPrepUniqueId
when adding a duplicate barcode #2886The text was updated successfully, but these errors were encountered: