2021-03-30 08:28:44 +00:00
|
|
|
ALTER TABLE `bs`.`waste`
|
|
|
|
ADD itemFk INT NULL AFTER `family`;
|
|
|
|
|
|
|
|
ALTER TABLE `bs`.`waste`
|
|
|
|
ADD itemTypeFk SMALLINT(5) UNSIGNED NULL AFTER `itemFk`;
|
|
|
|
|
|
|
|
ALTER TABLE `bs`.`waste`
|
|
|
|
ADD CONSTRAINT waste_itemType_id
|
|
|
|
FOREIGN KEY (itemTypeFk) REFERENCES vn.itemType (id)
|
|
|
|
ON UPDATE CASCADE;
|
|
|
|
|
|
|
|
ALTER TABLE `bs`.`waste`
|
|
|
|
ADD CONSTRAINT waste_item_id
|
|
|
|
FOREIGN KEY (itemFk) REFERENCES vn.item (id)
|
|
|
|
ON UPDATE CASCADE;
|
|
|
|
|
2021-04-06 11:46:38 +00:00
|
|
|
ALTER TABLE `bs`.`waste` DROP PRIMARY KEY;
|
|
|
|
|
|
|
|
ALTER TABLE `bs`.`waste`
|
2021-04-26 11:40:52 +00:00
|
|
|
ADD PRIMARY KEY (buyer, `year`, week, family, itemFk);
|
2021-04-06 11:46:38 +00:00
|
|
|
|