Add template animation editor

This commit is contained in:
2026-08-03 17:27:42 +01:00
parent e95928f31c
commit ed8d51580e
35 changed files with 3173 additions and 44 deletions
+14 -3
View File
@@ -107,9 +107,7 @@ const VERSIONED_MIGRATIONS = [
INDEX idx_announcements_modified_at (modified_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
`);
}
},
{
version: '2.4.0',
@@ -217,6 +215,13 @@ const VERSIONED_MIGRATIONS = [
`);
}
},
{
version: '2.5.1',
label: 'v2.5.1 template animation json schema',
run: async function (pool) {
await ensureColumn(pool, 'c_template_regions', 'animation_json', 'JSON NULL', 'lock_ratio');
}
}
];
async function columnExists(pool, tableName, columnName) {
@@ -260,7 +265,13 @@ async function ensureForeignKey(pool, tableName, constraintName, columnName, ref
async function dropColumnIfExists(pool, tableName, columnName) {
if (await columnExists(pool, tableName, columnName)) {
await pool.query('ALTER TABLE ' + tableName + ' DROP COLUMN ' + columnName);
try {
await pool.query('ALTER TABLE ' + tableName + ' DROP COLUMN ' + columnName);
} catch (error) {
if (!error || (error.code !== 'ER_CANT_DROP_FIELD_OR_KEY' && error.errno !== 1091)) {
throw error;
}
}
}
}