refactor: refs #7920 Fix version
gitea/salix/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Guillermo Bonet 2024-11-15 08:45:28 +01:00
parent b5463e5560
commit e1a091535e
8 changed files with 23 additions and 30 deletions

View File

@ -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;

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.itemShelving DROP FOREIGN KEY itemShelving_fk2,
MODIFY COLUMN shelvingFk int(11) NOT NULL;

View File

@ -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;

View File

@ -0,0 +1,3 @@
UPDATE vn.itemShelving ish
JOIN tmp.tItemShelving tish ON tish.id = ish.id
SET ish.shelvingFk = tish.shelvingFk;

View File

@ -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;

View File

@ -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;

View File

@ -0,0 +1 @@
ALTER TABLE vn.itemShelvingLog MODIFY COLUMN shelvingFk int(11) NOT NULL;

View File

@ -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;