Source: config/migrations/20260802-project-link-types.js

export const id = '20260802-project-link-types';
export const name = 'Add projectShare to Links.Type enum';

/**
 * A share is linked to exactly one project via Links.Type='projectShare'
 * with Links.UID = Project-UID and Links.UIDTarget = Share-UID. In addition
 * Share.UIDBelongsTo = Project-UID is used as a fast association query. Both
 * representations are written in the same transaction.
 */
export const migrate = async ({ query }) => {
    await query('SET @@system_versioning_alter_history = 1', []);
    await query(`
        ALTER TABLE Links
        MODIFY COLUMN \`Type\` enum('member','memberA','member0','memberSys','function','filter','list','dynamic','config','achievement','identifyer','admin','action','event','transaction','transactionLine','txReference','location','family','familyFees','memberS','locationC','locationT','memberGA','actionT','portal_pending','projectShare') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL
    `, []);
    await query('SET @@system_versioning_alter_history = 0', []);
};