From 443a752cfe8087ce82ee8a629feb4c21613b6994 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 11 Jul 2024 13:45:24 +0200 Subject: [PATCH] feat: refs #7704 Added check --- db/versions/11149-silverSalal/00-firstScript.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/versions/11149-silverSalal/00-firstScript.sql b/db/versions/11149-silverSalal/00-firstScript.sql index 588dcf1bd5..4bb0cdb470 100644 --- a/db/versions/11149-silverSalal/00-firstScript.sql +++ b/db/versions/11149-silverSalal/00-firstScript.sql @@ -16,7 +16,8 @@ CREATE TABLE `vn`.`itemMinimumQuantity` ( KEY `ended` (`ended`), KEY `warehouseFk` (`warehouseFk`), CONSTRAINT `itemMinimumQuantity_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `itemMinimumQuantity_ibfk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE + CONSTRAINT `itemMinimumQuantity_ibfk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, + CONSTRAINT `itemMinimumQuantity_check_1` CHECK (`started` <= `ended`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; GRANT SELECT, UPDATE, DELETE, INSERT ON TABLE vn.itemMinimumQuantity TO buyer;