Refactor Business Rules #5733
Replies: 6 comments
-
|
All very important things. Thanks for doing this! |
Beta Was this translation helpful? Give feedback.
-
|
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. |
Beta Was this translation helpful? Give feedback.
-
|
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 */; |
Beta Was this translation helpful? Give feedback.
-
|
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? |
Beta Was this translation helpful? Give feedback.
-
|
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? |
Beta Was this translation helpful? Give feedback.
-
|
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: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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
BusinessRuleExceptionwhen deleting and re-adding a collector with the same agent #2980IntegrityErrorthrown, blamingcollPrepUniqueIdwhen adding a duplicate barcode #2886Beta Was this translation helpful? Give feedback.
All reactions