diff --git a/payload/migrations/migrate.js b/payload/migrations/migrate.js deleted file mode 100644 index 6d80c8c..0000000 --- a/payload/migrations/migrate.js +++ /dev/null @@ -1,77 +0,0 @@ -import { commitTransaction } from '../../utilities/commitTransaction.js'; -import { initTransaction } from '../../utilities/initTransaction.js'; -import { killTransaction } from '../../utilities/killTransaction.js'; -import { getMigrations } from './getMigrations.js'; -import { readMigrationFiles } from './readMigrationFiles.js'; -export const migrate = async function migrate(args) { - const { payload } = this; - const migrationFiles = args?.migrations || await readMigrationFiles({ - payload - }); - payload.logger.info({ - msg: `... migrationFiles: ${JSON.stringify(migrationFiles)}` - }); - const { existingMigrations, latestBatch } = await getMigrations({ - payload - }); - payload.logger.info({ - msg: `... existingMigrations: ${JSON.stringify(existingMigrations)}` - }); - payload.logger.info({ - msg: `... latestBatch: ${latestBatch}` - }); - const newBatch = latestBatch + 1; - payload.logger.info({ - msg: `... newBatch: ${newBatch}` - }); - // Execute 'up' function for each migration sequentially - for (const migration of migrationFiles){ - payload.logger.info({ - msg: `... migration: ${JSON.stringify(migration)}` - }); - const existingMigration = existingMigrations.find((existing)=>existing.name === migration.name); - payload.logger.info({ - msg: `... existingMigration: ${existingMigration}` - }); - // Run migration if not found in database - if (existingMigration) { - continue; - } - const start = Date.now(); - const req = { - payload - }; - payload.logger.info({ - msg: `Migrating: ${migration.name}` - }); - try { - await initTransaction(req); - await migration.up({ - payload, - req - }); - payload.logger.info({ - msg: `Migrated: ${migration.name} (${Date.now() - start}ms)` - }); - await payload.create({ - collection: 'payload-migrations', - data: { - name: migration.name, - batch: newBatch - }, - req - }); - await commitTransaction(req); - } catch (err) { - await killTransaction(req); - payload.logger.error({ - err, - msg: `Error running migration ${migration.name}` - }); - throw err; - } - } -}; - - -//# sourceMappingURL=migrate.js.map \ No newline at end of file diff --git a/src/payload.config.ts b/src/payload.config.ts index dc8684a..cd67b5f 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -66,11 +66,7 @@ export default buildConfig({ } }), collections: [Pages, Posts, Media, Categories, Users], - logger: { - options: { - enabled: false - } - }, + logger: 'sync', cors: [getServerSideURL()].filter(Boolean), globals: [Header, Footer], plugins: [ @@ -104,7 +100,7 @@ export default buildConfig({ host: 'mailpit', port: 1025, secure: false, - skipVerify: true, + // skipVerify: true, logger: true, // debug: true } diff --git a/zerops.yml b/zerops.yml index 59108d8..eee46f5 100644 --- a/zerops.yml +++ b/zerops.yml @@ -14,7 +14,7 @@ zerops: buildCommands: - pnpm i - pnpm exec next telemetry disable - - cp -f ./payload/migrations/migrate.js ./node_modules/payload/dist/database/migrations/migrate.js + - pnpm payload migrate:status - pnpm payload migrate - pnpm build deployFiles: