9 lines
896 B
SQL
9 lines
896 B
SQL
-- Place your SQL code here
|
|
ALTER TABLE vn.deviceProductionUser DROP FOREIGN KEY deviceProductionUser_FK;
|
|
ALTER TABLE vn.deviceProductionUser DROP FOREIGN KEY deviceProductionUser_PK;
|
|
ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_FK FOREIGN KEY (deviceProductionFk) REFERENCES vn.deviceProduction(id)ON DELETE CASCADE ON UPDATE CASCADE;
|
|
ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_PK FOREIGN KEY (userFk) REFERENCES account.`user`(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_CK PRIMARY KEY (deviceProductionFk);
|
|
ALTER TABLE vn.deviceProductionUser ADD CONSTRAINT deviceProductionUser_UN UNIQUE KEY (userFk);
|
|
ALTER TABLE vn.deviceProductionUser ADD created TIMESTAMP NULL;
|
|
ALTER TABLE vn.deviceProductionUser MODIFY COLUMN created timestamp DEFAULT current_timestamp() NULL; |