2024-10-17 08:29:35 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS `vn`.`itemCampaignQuantity` (
|
2024-10-18 05:35:36 +00:00
|
|
|
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
2024-10-17 08:08:27 +00:00
|
|
|
dated date NOT NULL,
|
|
|
|
itemFk int(11) NOT NULL,
|
|
|
|
quantity decimal(10,2) NOT NULL,
|
2024-10-22 06:41:46 +00:00
|
|
|
total decimal(10,2) NOT NULL,
|
2024-10-17 08:08:27 +00:00
|
|
|
campaign varchar(100) NOT NULL,
|
2024-10-18 05:35:36 +00:00
|
|
|
UNIQUE KEY `itemCampaignQuantity_UNIQUE` (`dated`,`itemFk`),
|
2024-10-17 08:08:27 +00:00
|
|
|
CONSTRAINT itemCampaignQuantity_item_FK FOREIGN KEY (itemFk) REFERENCES vn.item(id) ON DELETE RESTRICT ON UPDATE CASCADE
|
|
|
|
)
|
|
|
|
ENGINE=InnoDB
|
|
|
|
DEFAULT CHARSET=utf8mb3
|
2024-10-18 05:35:36 +00:00
|
|
|
COLLATE=utf8mb3_unicode_ci
|
2024-10-18 05:44:28 +00:00
|
|
|
COMMENT='Tallos confirmados por día en los días de más producción de una campaña. La tabla está pensada para que sea una foto.';
|
2024-10-17 08:08:27 +00:00
|
|
|
|
2024-10-17 08:29:35 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS `vn`.`itemCampaignQuantityConfig` (
|
|
|
|
id int(10) unsigned NOT NULL PRIMARY KEY,
|
2024-10-17 08:08:27 +00:00
|
|
|
defaultCampaign varchar(100) NOT NULL COMMENT 'Campaña por defecto si se le pasa NULL',
|
|
|
|
previousDaysToInsert int(10) unsigned NOT NULL COMMENT 'Días anteriores a la fecha de fin de campaña para insertar',
|
|
|
|
CONSTRAINT `itemCampaignQuantityConfig_check` CHECK (`id` = 1)
|
|
|
|
)
|
|
|
|
ENGINE=InnoDB
|
|
|
|
DEFAULT CHARSET=utf8mb3
|
|
|
|
COLLATE=utf8mb3_unicode_ci;
|
|
|
|
|
2024-10-17 08:29:35 +00:00
|
|
|
INSERT IGNORE INTO `vn`.`itemCampaignQuantityConfig` (id, defaultCampaign, previousDaysToInsert)
|
2024-10-17 08:08:27 +00:00
|
|
|
VALUES (1, 'allSaints', 90);
|