{"record":{"id":"2c66d8b3c6f96b96","repo":"payloadcms/payload","slug":"migration-aborted-version-status-column-not-foun-2c66d8","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/sqlite/predefinedMigrations/localize-status/index.ts","lineNumber":80,"sourceCode":"      req,\n    })\n    locales = filteredLocaleObjects.map((locale) =>\n      typeof locale === 'string' ? locale : locale.code,\n    )\n  }\n  payload.logger.info({ msg: `Locales: ${locales.join(', ')}` })\n\n  // Check if versions are enabled in config (skip if not)\n  if (!entityConfig.versions) {\n    payload.logger.info({\n      msg: `Skipping migration for ${collectionSlug ? 'collection' : 'global'}: ${entitySlug} - versions not enabled`,\n    })\n    return\n  }\n\n  // Validate that version__status column exists before proceeding\n  if (!(await columnExists({ columnName: 'version__status', db, tableName: versionsTable }))) {\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  const localesTableExists = await tableExists({ db, tableName: localesTable })\n\n  if (!localesTableExists) {\n    // SCENARIO 1: Create the locales table (first localized field in versions)\n    payload.logger.info({ msg: `Creating new locales table: ${localesTable}` })\n\n    await db.run(\n      sql.raw(`CREATE TABLE \"${localesTable}\" (\n        id INTEGER PRIMARY KEY,\n        _locale TEXT NOT NULL,\n        _parent_id INTEGER NOT NULL,\n        version__status TEXT,","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/payloadcms/payload/blob/00c58b35c0ed348ddc22daabf467b139727214fd/packages/drizzle/src/sqlite/predefinedMigrations/localize-status/index.ts#L62-L98","documentation":"Thrown by migrateSqliteLocalizeStatus as a guard when the `version__status` column does not exist on the target versions table. This migration converts a single global status column into per-locale status rows; absence of `version__status` means the schema has already been migrated (or was never on the old schema), so re-running would be a no-op or destructive. The error message explicitly tells you no action is needed.","triggerScenarios":"Running migrateSqliteLocalizeStatus a second time on an entity that already completed the migration, or against a fresh schema that never had the old `version__status` column.","commonSituations":"Migration script is not idempotent-tracking and re-runs on every deploy; re-running after a partial failure that already mutated the column.","solutions":["Treat this error as a successful no-op: the schema is already in the per-locale-status state.","Track migration completion (e.g. a flag/migration record) so the script does not re-run on the same entity.","Wrap the call in a try/catch that swallows this specific guard error when you know re-runs are possible."],"exampleFix":"// before\nawait migrateSqliteLocalizeStatus({ db, payload, collectionSlug: 'posts' })\n// after\ntry {\n  await migrateSqliteLocalizeStatus({ db, payload, collectionSlug: 'posts' })\n} catch (err) {\n  if (!/version__status column not found/.test(err.message)) throw err\n  payload.logger.info('localize-status already applied, skipping')\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await migrateSqliteLocalizeStatus({ db, payload, collectionSlug })\n} catch (err) {\n  if (/version__status column not found/.test(err.message)) {\n    payload.logger.info('localize-status already applied; skipping')\n    return\n  }\n  throw err\n}","preventionTips":["Persist a 'migration applied' record per entity to avoid re-running.","Treat the 'column not found' error as an idempotency signal, not a real failure."],"tags":["migration","sqlite","localization","idempotency"],"backgroundTag":null,"analyzedSha":"00c58b35c0ed348ddc22daabf467b139727214fd","analyzedAt":"2026-08-12T20:45:03.758Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}