diff --git a/src/migrations/014_user_notes.js b/src/migrations/014_user_notes.js new file mode 100644 index 0000000..fe55c89 --- /dev/null +++ b/src/migrations/014_user_notes.js @@ -0,0 +1,19 @@ +import logger from '../utils/logger.js'; + +// Migration 014: add notes column to users (required by Next.js admin Prisma schema) +export default async function migration014(db, checkColumnExists) { + if (await checkColumnExists('users', 'notes')) { + logger.info('Migration 014: notes column already exists, skipping'); + return; + } + + await db.runAsync('BEGIN TRANSACTION'); + try { + await db.runAsync(`ALTER TABLE users ADD COLUMN notes TEXT`); + await db.runAsync('COMMIT'); + logger.info('Migration 014: Added notes column to users table'); + } catch (e) { + await db.runAsync('ROLLBACK'); + throw e; + } +} diff --git a/src/migrations/runner.js b/src/migrations/runner.js index 39df6e0..4d1da79 100644 --- a/src/migrations/runner.js +++ b/src/migrations/runner.js @@ -48,6 +48,7 @@ export async function runMigrations() { (await import('./011_active_flags.js')).default, (await import('./012_fix_typos.js')).default, (await import('./013_ai_features.js')).default, + (await import('./014_user_notes.js')).default, ]; for (let i = currentVersion; i < migrations.length; i++) {