UNPKG

knex-automigrate

Version:

Table schema based database migration tool, built on top of the knex.js

19 lines 814 B
import { Knex } from 'knex'; export interface AutomigrateOptions { config: Knex.Config & { safe?: boolean; }; cwd?: string; path?: string; verbose?: boolean; tables?: (migrator: TableMigrator, knex: Knex) => MigrationEntry[]; views?: (migrator: ViewMigrator, knex: Knex) => MigrationEntry[]; } export type TableMigrator = (tableName: string, fn: (table: Knex.CreateTableBuilder) => void, initRows?: (config: Knex.Config) => Record<string, unknown>[]) => MigrationEntry; export type ViewMigrator = (viewName: string, fn: (view: Knex.ViewBuilder) => void) => MigrationEntry; export interface MigrationEntry { call(): Promise<string>; } declare function Automigrate(opts: AutomigrateOptions): Promise<void>; export default Automigrate; //# sourceMappingURL=automigrate.d.ts.map