Notes/db/migrations/0228__fix_blobIds.sql

18 lines
812 B
MySQL
Raw Normal View History

2024-01-03 22:08:26 +01:00
-- + 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
2023-12-30 00:34:46 +01:00
2024-01-03 22:08:26 +01:00
UPDATE blobs SET blobId = REPLACE(blobId, '+', 'A');
UPDATE blobs SET blobId = REPLACE(blobId, '/', 'B');
2023-12-30 00:34:46 +01:00
2024-01-03 22:08:26 +01:00
UPDATE notes SET blobId = REPLACE(blobId, '+', 'A');
UPDATE notes SET blobId = REPLACE(blobId, '/', 'B');
2023-12-30 00:34:46 +01:00
2024-01-03 22:08:26 +01:00
UPDATE attachments SET blobId = REPLACE(blobId, '+', 'A');
UPDATE attachments SET blobId = REPLACE(blobId, '/', 'B');
2023-12-30 00:34:46 +01:00
2024-01-03 22:08:26 +01:00
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';