Merge pull request 'refs #6965 Add Fk vehicleFk firstEditorFk' (!2433) from 6965-AddFkRoute-vehicleFk-firstEditorFk into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #2433
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
This commit is contained in:
Ivan Mas 2024-05-16 11:41:31 +00:00
commit 9b5b269fe6
1 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
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);
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);