{"record":{"id":"379f3f17a4e911c6","repo":"payloadcms/payload","slug":"migration-aborted-version-status-column-not-foun","errorCode":null,"errorMessage":"Migration aborted: version__status column not found in ${versionsTable} table. This migration should only run on schemas that have NOT yet been migrated to per-locale status. If you've already run this migration, no action is needed.","messagePattern":"Migration aborted: version__status column not found in (.+?) table\\. This migration should only run on schemas that have NOT yet been migrated to per-locale status\\. If you've already run this migration, no action is needed\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/drizzle/src/postgres/predefinedMigrations/localize-status/index.ts","lineNumber":98,"sourceCode":"    })\n    return\n  }\n\n  // Validate that version__status column exists before proceeding\n  const columnCheckResult = await db.execute({\n    drizzle: db.drizzle,\n    sql: sql`\n      SELECT EXISTS (\n        SELECT FROM information_schema.columns\n        WHERE table_schema = ${schemaName}\n        AND table_name = ${versionsTable}\n        AND column_name = 'version__status'\n      ) as exists\n    `,\n  })\n\n  if (!columnCheckResult.rows[0]?.exists) {\n    throw new Error(\n      `Migration aborted: version__status column not found in ${versionsTable} table. ` +\n        `This migration should only run on schemas that have NOT yet been migrated to per-locale status. ` +\n        `If you've already run this migration, no action is needed.`,\n    )\n  }\n\n  // 1. Check if the locales table exists\n  const localesTableCheckResult = await db.execute({\n    drizzle: db.drizzle,\n    sql: sql`\n      SELECT EXISTS (\n        SELECT FROM information_schema.tables\n        WHERE table_schema = ${schemaName}\n        AND table_name = ${localesTable}\n      ) as exists\n    `,\n  })\n","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/drizzle/src/postgres/predefinedMigrations/localize-status/index.ts#L80-L116","documentation":"Guard from `migratePostgresLocalizeStatus`: before doing any writes it checks that the `version__status` column exists on the `_<entity>_v` versions table. The column is the v2-era single-status column this migration converts to per-locale status; its absence means the schema is either already migrated or never had v2-style status. The migration aborts rather than corrupt an already-migrated or fresh schema.","triggerScenarios":"Running the localize-status migration on a database where it has already run (column already dropped), or on a fresh v3 schema that never had `version__status`. Also if the entity slug maps to a non-existent versions table.","commonSituations":"Re-running the migration after partial completion; pointing the migration at a DB already upgraded to per-locale status; dev DB recreated from v3 schema (no v2 history).","solutions":["Treat the abort as benign if the migration already ran — no action is needed (the message says so explicitly).","If you believe it should run, confirm the DB is actually at the pre-migration v2 state (check `information_schema.columns` for `version__status` on the versions table).","Ensure you are pointing at the correct database/schema (`schemaName`) for the not-yet-migrated environment."],"exampleFix":"// Verify whether the migration is actually needed before invoking:\n// SELECT EXISTS (SELECT FROM information_schema.columns\n//   WHERE table_name = '_posts_v' AND column_name = 'version__status');\n// If false -> already migrated; skip migratePostgresLocalizeStatus.","handlingStrategy":"try-catch","validationCode":"// Pre-check the column; skip the migration if already converted\nconst { rows } = await db.execute({ drizzle: db.drizzle, sql: sql`\n  SELECT EXISTS (\n    SELECT FROM information_schema.columns\n    WHERE table_schema = ${schemaName}\n      AND table_name = ${versionsTable}\n      AND column_name = 'version__status'\n  ) as exists\n` })\nif (!rows[0]?.exists) {\n  payload.logger.info('version__status absent; localize-status migration already applied or not applicable.')\n} else {\n  await migratePostgresLocalizeStatus(args)\n}","typeGuard":"null","tryCatchPattern":"try {\n  await migratePostgresLocalizeStatus(args)\n} catch (err) {\n  if (/version__status column not found/.test(String(err?.message))) {\n    payload.logger.info('Localize-status migration not applicable; continuing.')\n    return\n  }\n  throw err\n}","preventionTips":["Treat this error as an idempotency guard, not a failure.","Record migration runs in a bookkeeping table to avoid re-invocation.","Pre-check the schema before invoking predefined migrations."],"tags":["migrations","localization","idempotency","predefined-migration"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}