pnpm payload migrate exits 1 in the migrator container likely due to TLA issues with Lexical packages (same issue seen with migrate:create). Replace with a small src/scripts/migrate.ts that calls payload.db.migrate() programmatically, using the same NODE_OPTIONS approach that works for seed.ts: NODE_OPTIONS="--experimental-strip-types --no-require-module" Also add migrator log output to the CD workflow for easier debugging. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
17 lines
558 B
TypeScript
17 lines
558 B
TypeScript
/**
|
|
* Production migration runner.
|
|
* Run via: NODE_OPTIONS="--experimental-strip-types --no-require-module" node src/scripts/migrate.ts
|
|
*
|
|
* Uses the same Node.js native TS-stripping approach as seed.ts.
|
|
* Called by the `migrator` Docker service before the app starts.
|
|
*/
|
|
import { getPayload } from 'payload';
|
|
import config from '../payload.config.ts';
|
|
|
|
const payload = await getPayload({ config });
|
|
|
|
console.log('[migrator] Running database migrations...');
|
|
await payload.db.migrate();
|
|
console.log('[migrator] Migrations complete.');
|
|
|
|
process.exit(0);
|