UNPKG

ordinality

Version:
28 lines (27 loc) 1.19 kB
import { SQLCompiler } from 'nano-queries/compilers/SQLCompiler'; import { ConfigurableSQLBuilder } from 'nano-queries/sql/ConfigurableSQLBuilder'; import { MigrationContext } from '../Migration'; import type { MigrationStorage } from './MigrationStorage'; export type BasicSQLTypes = string | number; export type DBQuery = (query: string, bindings: (string | number)[]) => Promise<Record<string, any>[]>; export declare const getSQLCompilerPreset: (preset: 'sqlite' | 'postgres' | 'mysql') => SQLCompiler<BasicSQLTypes>; /** * Custom storage that persists migration names */ export declare class SQLStorage<C extends MigrationContext<any, any>> implements MigrationStorage<C> { protected readonly config: { compiler: SQLCompiler<BasicSQLTypes>; query: DBQuery; tableName: string; }; protected readonly qb: ConfigurableSQLBuilder<BasicSQLTypes>; constructor(config: { compiler: SQLCompiler<BasicSQLTypes>; query: DBQuery; tableName?: string; }); log(uid: string, _context: C): Promise<void>; unlog(uid: string, _context: C): Promise<void>; list(): Promise<string[]>; ensureTable(): Promise<void>; }