14 lines
423 B
SQL
14 lines
423 B
SQL
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);
|
|
|
|
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);
|