salix/db/versions/10908-blueAsparagus/00-createSupplierDms.sql

17 lines
850 B
MySQL
Raw Normal View History

2024-02-23 14:32:21 +00:00
CREATE TABLE IF NOT EXISTS vn.supplierDms(
id int(11) NOT NULL AUTO_INCREMENT,
supplierFk int(11) NOT NULL,
dmsFk int(11) NOT NULL,
editorFk int(10) unsigned DEFAULT NULL,
PRIMARY KEY (id),
2024-02-23 15:27:49 +00:00
CONSTRAINT supplierDms_fk_editor FOREIGN KEY (editorFk) REFERENCES account.user(id),
2024-02-23 14:32:21 +00:00
CONSTRAINT dmsFk FOREIGN KEY (dmsFk) REFERENCES dms(id) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT supplierFk FOREIGN KEY (supplierFk) REFERENCES supplier(id) ON UPDATE CASCADE
);
2024-02-23 15:27:49 +00:00
ALTER TABLE `supplierLog`
MODIFY COLUMN `changedModel` ENUM('Supplier','SupplierAddress','SupplierAccount','SupplierContact','SupplierDms') NOT NULL DEFAULT 'Supplier';
ALTER TABLE `vn`.`supplierDms`
ADD IF NOT EXISTS editorFk INT UNSIGNED NULL,
ADD CONSTRAINT supplierDms_fk_editor FOREIGN KEY IF NOT EXISTS (editorFk) REFERENCES account.`user`(id);