salix/db/versions/11149-silverSalal/00-firstScript.sql

24 lines
1.2 KiB
MySQL
Raw Normal View History

2024-07-11 06:57:45 +00:00
ALTER TABLE vn.item CHANGE minQuantity minQuantity__ int(10) unsigned DEFAULT
NULL NULL COMMENT '@deprecated 2024-07-11 refs #7704 Cantidad mínima para una línea de venta';
CREATE TABLE `vn`.`itemMinimumQuantity` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`itemFk` int(10) NOT NULL,
`quantity` int(10) NOT NULL,
`started` date NOT NULL,
`ended` date DEFAULT NULL,
`warehouseFk` smallint(5) unsigned DEFAULT NULL,
`created` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `itemMinimumQuantity_UNIQUE` (`itemFk`, `started`, `ended`, `warehouseFk`),
KEY `itemFk` (`itemFk`),
KEY `started` (`started`),
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
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
2024-07-11 07:54:49 +00:00
GRANT SELECT, UPDATE, DELETE, INSERT ON TABLE vn.itemMinimumQuantity TO buyer;
2024-07-11 11:25:26 +00:00
GRANT EXECUTE ON PROCEDURE vn.ticketCalculatePurge TO guest;