diff --git a/db/versions/11444-orangeMastic/00-firstScript.sql b/db/versions/11444-orangeMastic/00-firstScript.sql new file mode 100644 index 0000000000..2476ea6f2c --- /dev/null +++ b/db/versions/11444-orangeMastic/00-firstScript.sql @@ -0,0 +1,8 @@ +UPDATE vn.claimEnd ce + JOIN( + SELECT id + FROM vn.claimEnd + WHERE claimDestinationFk NOT IN + (SELECT id FROM vn.claimDestination WHERE id IS NOT NULL) + ) s ON ce.id = s.id + SET ce.claimDestinationFk = 1; \ No newline at end of file diff --git a/db/versions/11444-orangeMastic/01-firstScript.sql b/db/versions/11444-orangeMastic/01-firstScript.sql new file mode 100644 index 0000000000..4b7bfb2863 --- /dev/null +++ b/db/versions/11444-orangeMastic/01-firstScript.sql @@ -0,0 +1,7 @@ +ALTER TABLE vn.claimEnd + MODIFY COLUMN claimDestinationFk tinyint(3) unsigned NOT NULL DEFAULT 1, + ADD CONSTRAINT fk_claimEnd_claimDestination + FOREIGN KEY (claimDestinationFk) + REFERENCES claimDestination(id) + ON UPDATE CASCADE + ON DELETE RESTRICT; \ No newline at end of file