All checks were successful
ci / test (pull_request) Successful in 17s
Pre-compiled ESM JS + .d.ts from tsconfig.build.json. Consumers install via 'git+https://gitea.bchen.dev/...#v0.1.0' so the built output must travel with the source. CI verifies in-sync via 'git diff --exit-code dist/'.
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import type Database from 'better-sqlite3';
|
|
export interface MigrationFile {
|
|
version: string;
|
|
name: string;
|
|
checksum: string;
|
|
body: string;
|
|
}
|
|
export interface MigrationRow {
|
|
version: string;
|
|
name: string;
|
|
checksum: string;
|
|
applied_at: number;
|
|
}
|
|
export interface MigrationSummary {
|
|
applied: number;
|
|
pending: number;
|
|
alreadyApplied: number;
|
|
stamped: string[];
|
|
}
|
|
export interface ApplyOptions {
|
|
logger?: (msg: string) => void;
|
|
stampGenesis?: boolean;
|
|
/** Default 'users'. Probe table that decides "is this a pre-existing prod DB needing genesis-stamping?". */
|
|
genesisProbeTable?: string;
|
|
}
|
|
export declare function listMigrations(migrationsDir: string): MigrationFile[];
|
|
export declare function readAppliedRows(db: Database.Database): MigrationRow[];
|
|
export declare function applyMigrations(db: Database.Database, migrationsDir: string, opts?: ApplyOptions): MigrationSummary;
|
|
export declare function stampMigration(db: Database.Database, migrationsDir: string, version: string): MigrationFile;
|