Changed the unique constraints in MSRunSample to ensure only a single placeholder record can exist for any one sequence and sample combo.
Details:
Changed handle_load_db_errors to build ConflictingValueError exceptions when the unique constraint has a defined condition attribute
Added method: find_conflicts
Made handle_load_db_errors able to identify ValidationErrors associated with "Constraint is violated"
Changed get_unique_constraint_fields to mix in Q expressions when a unique constraint has a defined condition.
Changed the MSRunSample ordering to use ArchiveFile.filename instead of whatever the record evaluates to (the ID?)
Updated the accucor loader to handle the new exceptions
Note, the MSRunSample ordering might need to be checked.
Affected Issues/Pull Requests
Partially addresses #947 (but in a different way)
Note, a follow-up PR will be created to migrate the data, so this should not be merged upon approval until that data migration is done. I was thinking that I would create dummy accucor records for the MSRunSample records that run afoul of the new unique constraint, which, on production is comprised of about 7 compounds, about 4 accucor files and about 52 samples.
Review Notes
See comments in-line.
Checklist
This pull request will be merged once the following requirements are met. The
author and/or reviewers should uncheck any unmet requirements:
Review requirements
Minimum approvals: 1
No changes requested
All blocking issues resolved by reviewers
Specific reviewers: @add_username_here
Review period: 2 days
Associated issue/pull request requirements:
[x] All requirements in affected issues marked "resolved" are satisfied
[x] All required pull requests are merged (or none)
Summary Change Description
Changed the unique constraints in MSRunSample to ensure only a single placeholder record can exist for any one sequence and sample combo.
Details:
Note, the MSRunSample ordering might need to be checked.
Affected Issues/Pull Requests
Note, a follow-up PR will be created to migrate the data, so this should not be merged upon approval until that data migration is done. I was thinking that I would create dummy accucor records for the MSRunSample records that run afoul of the new unique constraint, which, on production is comprised of about 7 compounds, about 4 accucor files and about 52 samples.
Review Notes
See comments in-line.
Checklist
This pull request will be merged once the following requirements are met. The author and/or reviewers should uncheck any unmet requirements:
changelog.md
(or no change)