Ensure FKs and indices in targetedms schema#1187
Ensure FKs and indices in targetedms schema#1187ankurjuneja wants to merge 2 commits intorelease26.3-SNAPSHOTfrom
Conversation
|
The failing test is already assigned in TC. |
labkey-jeckels
left a comment
There was a problem hiding this comment.
One or two requests.
| ALTER TABLE targetedms.QCAnnotation ADD CONSTRAINT FK_QCAnnotation_Container FOREIGN KEY (Container) REFERENCES core.Containers(EntityId); | ||
| ALTER TABLE targetedms.GuideSet ADD CONSTRAINT FK_GuideSet_Container FOREIGN KEY (Container) REFERENCES core.Containers(EntityId); | ||
| ALTER TABLE targetedms.AutoQCPing ADD CONSTRAINT FK_AutoQCPing_Container FOREIGN KEY (Container) REFERENCES core.Containers(EntityId); |
There was a problem hiding this comment.
These three could easily be deleted as part of the upgrade in case there are orphaned rows.
The other three would be harder because they have many more FKs pointed at them. Maybe we should do what I helped the MacCoss lab do - reparent any orphaned rows in Runs, PrecursorChromInfo, or SampleFileChromInfo to the /Shared project before doing the delete.
| new SqlExecutor(TargetedMSManager.getSchema()).execute("DELETE FROM " + TargetedMSManager.getTableInfoMSInstrument() + " WHERE Container = ?", c); | ||
| new SqlExecutor(TargetedMSManager.getSchema()).execute("DELETE FROM " + TargetedMSManager.getTableInfoPaymentMethod() + " WHERE Container = ?", c); | ||
| new SqlExecutor(TargetedMSManager.getSchema()).execute("DELETE FROM " + TargetedMSManager.getTableInfoRateType() + " WHERE Container = ?", c); | ||
| new SqlExecutor(TargetedMSManager.getSchema()).execute("DELETE FROM " + TargetedMSManager.getTableInfoSampleFileChromInfo() + " WHERE Container = ?", c); |
There was a problem hiding this comment.
If this is needed, it means that the call to deleteSampleFileDependent(getTableInfoSampleFileChromInfo()) in TargetedMSManager.purgeDeletedRuns() isn't doing what it should, or there's another codepath that should be doing the same thing.
Were there test failures or other repros that inspired adding it?
Rationale
Add missing foreign key to core.Containers and add missing dedicated index on containers on columns.
26.002-26.003 upgrade script is here #1185
Related Pull Requests
Changes
These tables have the Container column but lack a formal FOREIGN KEY constraint to the core.Containers table.
missing index: