- Abstract shared sql code to a new drizzle package - Adds sqlite package, not ready to publish until drizzle patches some issues - Add `transactionOptions` to allow customizing or disabling db transactions - Adds "experimental" label to the `schemaName` property until drizzle patches an issue
17 lines
460 B
TypeScript
17 lines
460 B
TypeScript
import type { MigrationTemplateArgs } from 'payload'
|
|
|
|
export const getMigrationTemplate = ({
|
|
downSQL,
|
|
imports,
|
|
upSQL,
|
|
}: MigrationTemplateArgs): string => `import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-sqlite'
|
|
${imports ? `${imports}\n` : ''}
|
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
|
${upSQL}
|
|
}
|
|
|
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
|
${downSQL}
|
|
}
|
|
`
|