diff --git a/db/versions/11186-blueHydrangea/00-firstScript.sql b/db/versions/11186-blueHydrangea/00-firstScript.sql new file mode 100644 index 000000000..6e235d913 --- /dev/null +++ b/db/versions/11186-blueHydrangea/00-firstScript.sql @@ -0,0 +1,22 @@ +CREATE TABLE `vn`.`packagingBoxType` ( + `code` varchar(100) NOT NULL, + `priority` int(11) unsigned NOT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + +CREATE TABLE `vn`.`packagingBox` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `packagingFk` varchar(10) NOT NULL, + `itemPackingTypeFk` varchar(1) NOT NULL, + `typeFk` varchar(100) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `packagingBox_packaging_FK` (`packagingFk`), + KEY `packagingBox_itemPackingType_FK` (`itemPackingTypeFk`), + KEY `packagingBox_packagingBoxType_FK` (`typeFk`), + CONSTRAINT `packagingBox_itemPackingType_FK` FOREIGN KEY (`itemPackingTypeFk`) REFERENCES `itemPackingType` (`code`) ON UPDATE CASCADE, + CONSTRAINT `packagingBox_packagingBoxType_FK` FOREIGN KEY (`typeFk`) REFERENCES `packagingBoxType` (`code`) ON UPDATE CASCADE, + CONSTRAINT `packagingBox_packaging_FK` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + +INSERT INTO vn.packagingBoxType (code, priority) + VALUES ('narrow', 1), ('wide', 2), ('square', 3);