diff --git a/db/versions/11342-crimsonDendro/00-firstScript.sql b/db/versions/11342-crimsonDendro/00-itemShelving.sql similarity index 73% rename from db/versions/11342-crimsonDendro/00-firstScript.sql rename to db/versions/11342-crimsonDendro/00-itemShelving.sql index 56bea2c03..7a173e203 100644 --- a/db/versions/11342-crimsonDendro/00-firstScript.sql +++ b/db/versions/11342-crimsonDendro/00-itemShelving.sql @@ -3,14 +3,14 @@ CREATE OR REPLACE TEMPORARY TABLE tItemShelving ENGINE = MEMORY SELECT ish.id, s.id shelvingFk FROM shelving s - JOIN itemShelving ish ON ish.shelvingFk = s.code; + JOIN 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 itemShelving ish - JOIN tItemShelving tis ON tis.id = ish.id - SET ish.shelvingFk = tis.shelvingFk; + JOIN tItemShelving tish ON tish.id = ish.id + SET ish.shelvingFk = tish.shelvingFk; DROP TEMPORARY TABLE tItemShelving; diff --git a/db/versions/11342-crimsonDendro/01-itemShelvingLog.sql b/db/versions/11342-crimsonDendro/01-itemShelvingLog.sql new file mode 100644 index 000000000..05f04b5ff --- /dev/null +++ b/db/versions/11342-crimsonDendro/01-itemShelvingLog.sql @@ -0,0 +1,14 @@ +CREATE OR REPLACE TEMPORARY TABLE tItemShelvingLog + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT ishl.id, s.id shelvingFk + FROM shelving s + JOIN itemShelvingLog ishl ON ishl.shelvingFk = s.code COLLATE utf8mb3_unicode_ci; + +ALTER TABLE vn.itemShelvingLog MODIFY COLUMN shelvingFk int(11) NOT NULL; + +UPDATE itemShelvingLog ishl + JOIN tItemShelvingLog tishl ON tishl.id = ishl.id + SET ishl.shelvingFk = tishl.shelvingFk; + +DROP TEMPORARY TABLE tItemShelvingLog;