Files
cloudron-box/migrations/20250618184304-volumes-truncate-hostPath.js
Girish Ramakrishnan b23699f0c1 db: change the encoding and collation
by mistake many fields are encoded at utf8 which is an alias of utf8mb3

fixes #836
2025-06-18 22:08:43 +02:00

12 lines
436 B
JavaScript

'use strict';
exports.up = async function (db) {
// InnoDB has a strict maximum index key length. utf8mb8 (next migration) means 1024*4=4096. max in our db is 3072
await db.runSql('UPDATE volumes SET hostPath=LEFT(hostPath, 768)');
await db.runSql('ALTER TABLE volumes MODIFY hostPath VARCHAR(768) NOT NULL UNIQUE');
};
exports.down = async function (db) {
await db.runSql('ALTER TABLE tasks DROP COLUMN pending');
};