diff --git a/db/versions/11258-silverTulip/00-firstScript.sql b/db/versions/11258-silverTulip/00-firstScript.sql index 6f0f1906a..060dbc515 100644 --- a/db/versions/11258-silverTulip/00-firstScript.sql +++ b/db/versions/11258-silverTulip/00-firstScript.sql @@ -1,8 +1,6 @@ -- vn.priceDelta definition --- vn.priceDelta definition - -CREATE OR REPLACE TABLE vn.`priceDelta` ( +CREATE OR REPLACE TABLE vn.priceDelta ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `itemTypeFk` smallint(5) unsigned NOT NULL, `minSize` int(10) unsigned DEFAULT NULL COMMENT 'Minimum item.size', @@ -15,13 +13,17 @@ CREATE OR REPLACE TABLE vn.`priceDelta` ( `absIncreasing` decimal(10,3) DEFAULT NULL COMMENT 'Absolute increasing of final price', `ratIncreasing` int(11) DEFAULT NULL COMMENT 'Increasing ratio for the cost price', `warehouseFk` smallint(6) unsigned NOT NULL, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + `editorFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `priceDelta_itemType_FK` (`itemTypeFk`), KEY `priceDelta_ink_FK` (`inkFk`), KEY `priceDelta_producer_FK` (`producerFk`), KEY `priceDelta_warehouse_FK` (`warehouseFk`), + KEY `priceDelta_worker_FK` (`editorFk`), CONSTRAINT `priceDelta_ink_FK` FOREIGN KEY (`inkFk`) REFERENCES `ink` (`id`) ON UPDATE CASCADE, CONSTRAINT `priceDelta_itemType_FK` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE, CONSTRAINT `priceDelta_producer_FK` FOREIGN KEY (`producerFk`) REFERENCES `producer` (`id`) ON UPDATE CASCADE, - CONSTRAINT `priceDelta_warehouse_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE + CONSTRAINT `priceDelta_warehouse_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, + CONSTRAINT `priceDelta_worker_FK` FOREIGN KEY (`editorFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Defines the increasing o decreasing for ranges of items'; \ No newline at end of file