From 72f5705bd4b55ff4cfc0774b5e91378427989c24 Mon Sep 17 00:00:00 2001 From: KarlLevik Date: Wed, 9 Aug 2023 14:37:12 +0100 Subject: [PATCH] Add containerTypeId FK for Screen table --- .../ispyb/updates/2023_08_09_Screen_fk_containerTypeId.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 schemas/ispyb/updates/2023_08_09_Screen_fk_containerTypeId.sql diff --git a/schemas/ispyb/updates/2023_08_09_Screen_fk_containerTypeId.sql b/schemas/ispyb/updates/2023_08_09_Screen_fk_containerTypeId.sql new file mode 100644 index 00000000..0dd48cb1 --- /dev/null +++ b/schemas/ispyb/updates/2023_08_09_Screen_fk_containerTypeId.sql @@ -0,0 +1,7 @@ +INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2023_08_09_Screen_fk_containerTypeId.sql', 'ONGOING'); + +ALTER TABLE Screen + ADD containerTypeId int(10) unsigned, + ADD CONSTRAINT Screen_fk_containerTypeId FOREIGN KEY (containerTypeId) REFERENCES ContainerType(containerTypeId) ON UPDATE CASCADE ON DELETE RESTRICT; + +UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2023_08_09_Screen_fk_containerTypeId.sql';