salix/db/versions/11040-grayMonstera/00-firstScript.sql

17 lines
496 B
MySQL
Raw Permalink Normal View History

UPDATE vn.route
SET vehicleFk = NULL
WHERE vehicleFk NOT IN (SELECT id FROM vn.vehicle);
ALTER TABLE vn.route
ADD CONSTRAINT route_vehicleFk FOREIGN KEY (vehicleFk) REFERENCES vn.vehicle(id);
2024-05-16 11:15:55 +00:00
ALTER TABLE vn.route
MODIFY COLUMN firstEditorFk int(10) unsigned NULL;
UPDATE vn.route
SET firstEditorFk = NULL
WHERE firstEditorFk NOT IN (SELECT id FROM account.user);
ALTER TABLE vn.route
ADD CONSTRAINT route_firstEditorFk FOREIGN KEY (firstEditorFk) REFERENCES account.user(id);