salix/db/versions/11088-bronzeAspidistra/00-firstScript.sql

20 lines
1.2 KiB
MySQL
Raw Permalink Normal View History

2024-09-13 06:54:03 +00:00
ALTER TABLE vn.collectionWagonTicket DROP FOREIGN KEY IF EXISTS collectionWagonTicket_tray;
ALTER TABLE vn.wagonConfig DROP FOREIGN KEY IF EXISTS wagonConfig_wagonTypeColor_FK;
2024-09-10 05:50:40 +00:00
CREATE OR REPLACE TABLE vn.wagonTypeTray (
2024-09-13 09:29:05 +00:00
id INT(11) UNSIGNED auto_increment,
wagonTypeFk INT(11) UNSIGNED NULL,
2024-09-13 06:54:03 +00:00
height INT(11) UNSIGNED NULL,
2024-09-13 09:29:05 +00:00
wagonTypeColorFk int(11) UNSIGNED NULL,
CONSTRAINT wagonTypeTray_pk PRIMARY KEY (id),
2024-09-13 06:29:41 +00:00
CONSTRAINT wagonTypeTray_wagonType_FK FOREIGN KEY (wagonTypeFk) REFERENCES vn.wagonType(id) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT wagonTypeTray_wagonTypeColor_FK FOREIGN KEY (wagonTypeColorFk) REFERENCES vn.wagonTypeColor(id)
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci;
ALTER TABLE vn.wagonConfig ADD IF NOT EXISTS defaultHeight INT UNSIGNED DEFAULT 0 NULL COMMENT 'Default height in cm for a base tray';
2024-09-13 09:29:05 +00:00
ALTER TABLE vn.wagonConfig ADD IF NOT EXISTS defaultTrayColorFk int(11) UNSIGNED NULL COMMENT 'Default color for a base tray';
ALTER TABLE vn.wagonConfig ADD CONSTRAINT wagonConfig_wagonTypeColor_FK FOREIGN KEY (defaultTrayColorFk) REFERENCES vn.wagonTypeColor(id);
2024-09-13 06:54:03 +00:00
ALTER TABLE vn.collectionWagonTicket ADD CONSTRAINT collectionWagonTicket_tray FOREIGN KEY (trayFk) REFERENCES vn.wagonTypeTray(id);