8144-devToTest_2448 #3216
|
@ -2,19 +2,5 @@ CREATE OR REPLACE TEMPORARY TABLE tmp.tItemShelving
|
|||
(PRIMARY KEY (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT ish.id, s.id shelvingFk
|
||||
FROM vn.shelving s
|
||||
JOIN vn.itemShelving ish ON ish.shelvingFk = s.code COLLATE utf8mb3_unicode_ci;
|
||||
|
||||
ALTER TABLE vn.itemShelving DROP FOREIGN KEY itemShelving_fk2,
|
||||
MODIFY COLUMN shelvingFk int(11) NOT NULL;
|
||||
|
||||
UPDATE vn.itemShelving ish
|
||||
JOIN tmp.tItemShelving tish ON tish.id = ish.id
|
||||
SET ish.shelvingFk = tish.shelvingFk;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.tItemShelving;
|
||||
|
||||
ALTER TABLE vn.itemShelving
|
||||
ADD CONSTRAINT itemShelving_shelving_FK FOREIGN KEY (shelvingFk) REFERENCES vn.shelving(id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
||||
FROM vn.itemShelving ish
|
||||
JOIN vn.shelving s ON s.code = ish.shelvingFk COLLATE utf8mb3_unicode_ci;
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE vn.itemShelving DROP FOREIGN KEY itemShelving_fk2,
|
||||
MODIFY COLUMN shelvingFk int(11) NOT NULL;
|
|
@ -1,14 +0,0 @@
|
|||
CREATE OR REPLACE TEMPORARY TABLE tmp.tItemShelvingLog
|
||||
(PRIMARY KEY (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT ishl.id, s.id shelvingFk
|
||||
FROM vn.shelving s
|
||||
JOIN vn.itemShelvingLog ishl ON ishl.shelvingFk = s.code COLLATE utf8mb3_unicode_ci;
|
||||
|
||||
ALTER TABLE vn.itemShelvingLog MODIFY COLUMN shelvingFk int(11) NOT NULL;
|
||||
|
||||
UPDATE vn.itemShelvingLog ishl
|
||||
JOIN tmp.tItemShelvingLog tishl ON tishl.id = ishl.id
|
||||
SET ishl.shelvingFk = tishl.shelvingFk;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.tItemShelvingLog;
|
|
@ -0,0 +1,3 @@
|
|||
UPDATE vn.itemShelving ish
|
||||
JOIN tmp.tItemShelving tish ON tish.id = ish.id
|
||||
SET ish.shelvingFk = tish.shelvingFk;
|
|
@ -0,0 +1,4 @@
|
|||
ALTER TABLE vn.itemShelving
|
||||
ADD CONSTRAINT itemShelving_shelving_FK FOREIGN KEY (shelvingFk) REFERENCES vn.shelving(id)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
|
@ -0,0 +1,6 @@
|
|||
CREATE OR REPLACE TEMPORARY TABLE tmp.tItemShelvingLog
|
||||
(PRIMARY KEY (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT ishl.id, s.id shelvingFk
|
||||
FROM vn.itemShelvingLog ishl
|
||||
JOIN vn.shelving s ON s.code = ishl.shelvingFk COLLATE utf8mb3_unicode_ci;
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE vn.itemShelvingLog MODIFY COLUMN shelvingFk int(11) NOT NULL;
|
|
@ -0,0 +1,5 @@
|
|||
UPDATE vn.itemShelvingLog ishl
|
||||
JOIN tmp.tItemShelvingLog tishl ON tishl.id = ishl.id
|
||||
SET ishl.shelvingFk = tishl.shelvingFk;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.tItemShelvingLog;
|
Loading…
Reference in New Issue