-
Notifications
You must be signed in to change notification settings - Fork 4
Ensure FKs and indices in targetedms schema #1187
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
base: release26.3-SNAPSHOT
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| -- Adding missing foreign keys to core.Containers(EntityId) | ||
| ALTER TABLE targetedms.Runs ADD CONSTRAINT FK_Runs_Container FOREIGN KEY (Container) REFERENCES core.Containers(EntityId); | ||
| 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); | ||
| ALTER TABLE targetedms.PrecursorChromInfo ADD CONSTRAINT FK_PrecursorChromInfo_Container FOREIGN KEY (Container) REFERENCES core.Containers(EntityId); | ||
| ALTER TABLE targetedms.SampleFileChromInfo ADD CONSTRAINT FK_SampleFileChromInfo_Container FOREIGN KEY (Container) REFERENCES core.Containers(EntityId); | ||
|
|
||
| -- Adding missing indices on Container | ||
| CREATE INDEX IX_QCAnnotationType_Container ON targetedms.QCAnnotationType(Container); | ||
| CREATE INDEX IX_QCAnnotation_Container ON targetedms.QCAnnotation(Container); | ||
| CREATE INDEX IX_GuideSet_Container ON targetedms.GuideSet(Container); | ||
| CREATE INDEX IX_QCMetricConfiguration_Container ON targetedms.QCMetricConfiguration(Container); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,5 +71,6 @@ public void containerDeleted(Container c, User user) | |
| 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); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is needed, it means that the call to Were there test failures or other repros that inspired adding it? |
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.