Source: config/migrations/20260412-treequeue-type-varchar.js

/**
 * Migration: Convert TreeQueue.Type from ENUM to VARCHAR(64)
 *
 * The ENUM constraint required a schema change every time a new queue type was
 * added. Converting to VARCHAR(64) removes that friction and allows new action
 * types (e.g. 'personFilter') to be introduced in application code alone.
 *
 * Existing values are preserved; the column is made NOT NULL with no default,
 * matching the previous ENUM behaviour.
 */

export const id = '20260412-treequeue-type-varchar';

export const name = 'TreeQueue.Type: ENUM → VARCHAR(64)';

/**
 * @param {{ query: Function }} api
 */
export const migrate = async ({ query }) => {
    await query(`
        ALTER TABLE TreeQueue
        MODIFY COLUMN Type varchar(64)
            CHARACTER SET utf8mb3
            COLLATE utf8mb3_unicode_ci
            NOT NULL
    `, []);
};