From 2706af6976a058d7cc88f528ad934e44e72280fc Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 6 Nov 2015 09:05:08 +0100 Subject: [PATCH] schema/mysql: fix import source constraints --- schema/mysql-changes/upgrade_42.sql | 7 +++++++ schema/mysql.sql | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 schema/mysql-changes/upgrade_42.sql diff --git a/schema/mysql-changes/upgrade_42.sql b/schema/mysql-changes/upgrade_42.sql new file mode 100644 index 00000000..849ffda9 --- /dev/null +++ b/schema/mysql-changes/upgrade_42.sql @@ -0,0 +1,7 @@ +ALTER TABLE import_run DROP FOREIGN KEY import_run_source; +ALTER TABLE import_run ADD CONSTRAINT import_run_source + FOREIGN KEY import_source (source_id) + REFERENCES import_source (id) + ON DELETE CASCADE + ON UPDATE RESTRICT; + diff --git a/schema/mysql.sql b/schema/mysql.sql index e29a24be..5e23e371 100644 --- a/schema/mysql.sql +++ b/schema/mysql.sql @@ -877,8 +877,8 @@ CREATE TABLE import_run ( CONSTRAINT import_run_source FOREIGN KEY import_source (source_id) REFERENCES import_source (id) - ON DELETE RESTRICT - ON UPDATE CASCADE, + ON DELETE CASCADE + ON UPDATE RESTRICT, CONSTRAINT import_run_rowset FOREIGN KEY rowset (rowset_checksum) REFERENCES imported_rowset (checksum)