/**
 * Migration: AddUserIdToJwtRevocationsTable
 * Adds a 'user_id' column so developers can attribute JWT session/revocation rows to a user.
 */
import { Schema as MigrationSchema } from '../../src/migrations/schema';
export const migration = {
    async up(db) {
        const schema = MigrationSchema.create(db);
        const hasUserId = await schema.hasColumn('zintrust_jwt_revocations', 'user_id');
        if (!hasUserId) {
            await schema.table('zintrust_jwt_revocations', (table) => {
                table.string('user_id', 191).nullable();
                table.index(['user_id']);
            });
        }
    },
    async down(_db) {
        // Note: dropping columns/FKs varies by driver; SQLite/D1 requires a table rebuild.
    },
};
