Files
payload/packages/db-postgres/src/getMigrationTemplate.ts
Dan Ribbens 1dc428823a fix(db-postgres): migration template type error (#7403)
Fixes #7402

This fixes a regression from changes to the postgres migration template
that were incorrect. It also fixes other type errors for
`payload.db.drizzle` which needed to be declared for postgres to avoid
confusing it with Libsql for SQLite.
2024-07-27 21:52:36 -04:00

17 lines
454 B
TypeScript

import type { MigrationTemplateArgs } from 'payload'
export const getMigrationTemplate = ({
downSQL,
imports,
upSQL,
}: MigrationTemplateArgs): string => `import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
${imports ? `${imports}\n` : ''}
export async function up({ payload, req }: MigrateUpArgs): Promise<void> {
${upSQL}
}
export async function down({ payload, req }: MigrateDownArgs): Promise<void> {
${downSQL}
}
`