UNPKG

@accounter/server

Version:
19 lines (18 loc) 763 B
import { sql, type DatabasePool, type DatabaseTransactionConnection } from 'slonik'; export type MigrationExecutor = { name: string; noTransaction?: boolean; /** * You can either return a SQL query to run or instead use the connection within the function to run custom logic. * You can also return an array of named steps so you can see the progress in the logs. */ run: (args: { sql: typeof sql.unsafe; connection: DatabaseTransactionConnection | DatabasePool; }) => Promise<void> | ReturnType<typeof sql.unsafe> | Promise<ReturnType<typeof sql.unsafe>>; }; export declare function runMigrations(args: { slonik: DatabasePool; migrations: Array<MigrationExecutor>; runTo?: string; }): Promise<void>;