From a28d8843acca22eeedb5a309abb1e00f373cfb6d Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 3 Jan 2024 22:08:26 +0100 Subject: [PATCH] fix migration --- db/migrations/0228__fix_blobIds.sql | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/db/migrations/0228__fix_blobIds.sql b/db/migrations/0228__fix_blobIds.sql index 725e9d1f2..339a6100a 100644 --- a/db/migrations/0228__fix_blobIds.sql +++ b/db/migrations/0228__fix_blobIds.sql @@ -1,14 +1,17 @@ -UPDATE blobs SET blobId = REPLACE(blobId, '+', 'X'); -UPDATE blobs SET blobId = REPLACE(blobId, '/', 'Y'); +-- + is normally replaced by X and / by Y, but this can temporarily cause UNIQUE key exception +-- this might create blob duplicates, but cleanup will eventually take care of it -UPDATE notes SET blobId = REPLACE(blobId, '+', 'X'); -UPDATE notes SET blobId = REPLACE(blobId, '/', 'Y'); +UPDATE blobs SET blobId = REPLACE(blobId, '+', 'A'); +UPDATE blobs SET blobId = REPLACE(blobId, '/', 'B'); -UPDATE attachments SET blobId = REPLACE(blobId, '+', 'X'); -UPDATE attachments SET blobId = REPLACE(blobId, '/', 'Y'); +UPDATE notes SET blobId = REPLACE(blobId, '+', 'A'); +UPDATE notes SET blobId = REPLACE(blobId, '/', 'B'); -UPDATE revisions SET blobId = REPLACE(blobId, '+', 'X'); -UPDATE revisions SET blobId = REPLACE(blobId, '/', 'Y'); +UPDATE attachments SET blobId = REPLACE(blobId, '+', 'A'); +UPDATE attachments SET blobId = REPLACE(blobId, '/', 'B'); -UPDATE entity_changes SET entityId = REPLACE(entityId, '+', 'X') WHERE entityName = 'blobs'; -UPDATE entity_changes SET entityId = REPLACE(entityId, '/', 'Y') WHERE entityName = 'blobs'; +UPDATE revisions SET blobId = REPLACE(blobId, '+', 'A'); +UPDATE revisions SET blobId = REPLACE(blobId, '/', 'B'); + +UPDATE entity_changes SET entityId = REPLACE(entityId, '+', 'A') WHERE entityName = 'blobs'; +UPDATE entity_changes SET entityId = REPLACE(entityId, '/', 'B') WHERE entityName = 'blobs';