2024-09-24 06:50:34 +00:00
|
|
|
-- vn.priceDelta definition
|
2024-09-23 11:12:53 +00:00
|
|
|
|
2024-09-24 11:04:03 +00:00
|
|
|
CREATE OR REPLACE TABLE vn.priceDelta (
|
2024-09-23 11:12:53 +00:00
|
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
|
|
|
`itemTypeFk` smallint(5) unsigned NOT NULL,
|
|
|
|
`minSize` int(10) unsigned DEFAULT NULL COMMENT 'Minimum item.size',
|
|
|
|
`maxSize` int(10) unsigned DEFAULT NULL COMMENT 'Maximum item.size',
|
|
|
|
`inkFk` varchar(3) DEFAULT NULL,
|
|
|
|
`originFk` tinyint(2) unsigned DEFAULT NULL,
|
|
|
|
`producerFk` mediumint(3) unsigned DEFAULT NULL,
|
|
|
|
`fromDated` date DEFAULT NULL,
|
|
|
|
`toDated` date DEFAULT NULL,
|
|
|
|
`absIncreasing` decimal(10,3) DEFAULT NULL COMMENT 'Absolute increasing of final price',
|
|
|
|
`ratIncreasing` int(11) DEFAULT NULL COMMENT 'Increasing ratio for the cost price',
|
2024-09-24 07:05:30 +00:00
|
|
|
`warehouseFk` smallint(6) unsigned NOT NULL,
|
2024-09-24 11:04:03 +00:00
|
|
|
`created` timestamp NOT NULL DEFAULT current_timestamp(),
|
|
|
|
`editorFk` int(10) unsigned DEFAULT NULL,
|
2024-09-23 11:12:53 +00:00
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
KEY `priceDelta_itemType_FK` (`itemTypeFk`),
|
|
|
|
KEY `priceDelta_ink_FK` (`inkFk`),
|
|
|
|
KEY `priceDelta_producer_FK` (`producerFk`),
|
2024-09-24 07:05:30 +00:00
|
|
|
KEY `priceDelta_warehouse_FK` (`warehouseFk`),
|
2024-09-24 11:04:03 +00:00
|
|
|
KEY `priceDelta_worker_FK` (`editorFk`),
|
2024-09-23 11:12:53 +00:00
|
|
|
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,
|
2024-09-24 07:05:30 +00:00
|
|
|
CONSTRAINT `priceDelta_producer_FK` FOREIGN KEY (`producerFk`) REFERENCES `producer` (`id`) ON UPDATE CASCADE,
|
2024-09-24 11:04:03 +00:00
|
|
|
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
|
2024-09-24 11:53:24 +00:00
|
|
|
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Defines the increasing o decreasing for ranges of items';
|
|
|
|
|
2024-09-24 11:56:41 +00:00
|
|
|
GRANT INSERT, SELECT, UPDATE, DELETE ON TABLE vn.priceDelta TO buyer;
|