diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 8544686e8..630e24e1d 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -1254,9 +1254,9 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `visible`, `grouping`, `packing`,`buyFk`, `userFk`) VALUES - (2, 'GVC', 1, 1, 1, 2,1106), - (4, 'HEJ', 1, 1, 1, NULL,1106), - (1, 'UXN', 2, 12, 12, NULL,1106); + (2, 11, 1, 1, 1, 2,1106), + (4, 12, 1, 1, 1, NULL,1106), + (1, 13, 2, 12, 12, NULL,1106); INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`) VALUES @@ -3425,7 +3425,7 @@ INSERT INTO vn.buy INSERT INTO vn.itemShelving SET id = 9931, itemFk = 999993, - shelvingFk = 'NCC', + shelvingFk = 16, visible = 10, `grouping` = 5, packing = 10; @@ -3752,7 +3752,7 @@ INSERT vn.sale USE vn; DELETE ish.* FROM vn.itemShelving ish - JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.shelving sh ON sh.id = ish.shelvingFk JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.sector s ON s.id = p.sectorFk JOIN vn.warehouse w ON w.id = s.warehouseFk @@ -3761,22 +3761,22 @@ DELETE ish.* FROM vn.itemShelving ish INSERT INTO vn.itemShelving (itemFk, shelvingFk, visible, created, `grouping`, packing, packagingFk, userFk, isChecked) VALUES - (999991, 'NAA', 8, '2023-09-20', 1, 20, NULL, 103, NULL), - (999998, 'NAA', 80, '2023-09-20', 10, 30, NULL, 103, NULL), - (1000001, 'NAA', 6, '2023-09-20', 3, 50, NULL, 103, NULL), - (1000000, 'NBB', 50, '2023-09-18', 25, 500, NULL, 103, NULL), - (999993, 'NBB', 25, '2023-09-18', NULL, 10, NULL, 103, NULL), - (999999, 'NBB', 30, '2023-09-18', 10, 500, NULL, 103, NULL), - (999993, 'NCC', 25, '2023-09-20', 5, 10, NULL, 103, NULL), - (999997, 'NCC', 10, '2023-09-20', NULL, 100, NULL, 103, NULL), - (999999, 'NCC', 40, '2023-09-20', 10, 500, NULL, 103, NULL), - (999995, 'NDD', 10, '2023-09-19', NULL, 20, NULL, 103, NULL), - (999994, 'NDD', 48, '2023-09-19', 4, 20, NULL, 103, NULL), - (1000001, 'NEE', 6, '2023-09-21', 3, 50, NULL, 103, NULL), - (999992, 'NEE', 50, '2023-09-21', NULL, 1, NULL, 103, NULL), - (1000000, 'NEE', 25, '2023-09-21', 25, 500, NULL, 103, NULL), - (999996, 'PAA', 5, '2023-09-27', 1, 5, NULL, 103, NULL), - (999997, 'PCC', 10, '2023-09-27', 5, 100, NULL, 103, NULL); + (999991, 14, 8, '2023-09-20', 1, 20, NULL, 103, NULL), + (999998, 14, 80, '2023-09-20', 10, 30, NULL, 103, NULL), + (1000001, 14, 6, '2023-09-20', 3, 50, NULL, 103, NULL), + (1000000, 15, 50, '2023-09-18', 25, 500, NULL, 103, NULL), + (999993, 15, 25, '2023-09-18', NULL, 10, NULL, 103, NULL), + (999999, 15, 30, '2023-09-18', 10, 500, NULL, 103, NULL), + (999993, 16, 25, '2023-09-20', 5, 10, NULL, 103, NULL), + (999997, 16, 10, '2023-09-20', NULL, 100, NULL, 103, NULL), + (999999, 16, 40, '2023-09-20', 10, 500, NULL, 103, NULL), + (999995, 17, 10, '2023-09-19', NULL, 20, NULL, 103, NULL), + (999994, 17, 48, '2023-09-19', 4, 20, NULL, 103, NULL), + (1000001, 18, 6, '2023-09-21', 3, 50, NULL, 103, NULL), + (999992, 18, 50, '2023-09-21', NULL, 1, NULL, 103, NULL), + (1000000, 18, 25, '2023-09-21', 25, 500, NULL, 103, NULL), + (999996, 19, 5, '2023-09-27', 1, 5, NULL, 103, NULL), + (999997, 21, 10, '2023-09-27', 5, 100, NULL, 103, NULL); -- Previous for Bolas de madera INSERT IGNORE INTO vn.sectorCollection diff --git a/db/versions/11342-crimsonDendro/00-firstScript.sql b/db/versions/11342-crimsonDendro/00-firstScript.sql new file mode 100644 index 000000000..56bea2c03 --- /dev/null +++ b/db/versions/11342-crimsonDendro/00-firstScript.sql @@ -0,0 +1,20 @@ +CREATE OR REPLACE TEMPORARY TABLE tItemShelving + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT ish.id, s.id shelvingFk + FROM shelving s + JOIN itemShelving ish ON ish.shelvingFk = s.code; + +ALTER TABLE vn.itemShelving DROP FOREIGN KEY itemShelving_fk2, + MODIFY COLUMN shelvingFk int(11) NOT NULL; + +UPDATE itemShelving ish + JOIN tItemShelving tis ON tis.id = ish.id + SET ish.shelvingFk = tis.shelvingFk; + +DROP TEMPORARY TABLE tItemShelving; + +ALTER TABLE vn.itemShelving + ADD CONSTRAINT itemShelving_shelving_FK FOREIGN KEY (shelvingFk) REFERENCES vn.shelving(id) + ON DELETE RESTRICT + ON UPDATE CASCADE;