graphile-migrate
Version:
Opinionated SQL-powered migration tool for PostgreSQL
55 lines (54 loc) • 1.94 kB
TypeScript
import { Logger } from "@graphile/logger";
import { ActionSpec, CommandActionSpec, SqlActionSpec } from "./actions";
export declare type Actions = string | Array<string | ActionSpec>;
export declare function isActionSpec(o: unknown): o is ActionSpec;
export declare function isSqlActionSpec(o: unknown): o is SqlActionSpec;
export declare function isCommandActionSpec(o: unknown): o is CommandActionSpec;
/**
* This type is not trusted; to use the values within it, it must be
* parsed/validated into ParsedSettings.
*/
export interface Settings {
connectionString?: string;
shadowConnectionString?: string;
rootConnectionString?: string;
databaseOwner?: string;
migrationsFolder?: string;
manageGraphileMigrateSchema?: boolean;
pgSettings?: {
[key: string]: string;
};
placeholders?: {
[key: string]: string;
};
beforeReset?: Actions;
afterReset?: Actions;
beforeAllMigrations?: Actions;
afterAllMigrations?: Actions;
beforeCurrent?: Actions;
afterCurrent?: Actions;
blankMigrationContent?: string;
logger?: Logger;
}
export interface ParsedSettings extends Settings {
connectionString: string;
rootConnectionString: string;
databaseOwner: string;
databaseName: string;
shadowDatabaseName?: string;
migrationsFolder: string;
beforeReset: ActionSpec[];
afterReset: ActionSpec[];
beforeAllMigrations: ActionSpec[];
afterAllMigrations: ActionSpec[];
beforeCurrent: ActionSpec[];
afterCurrent: ActionSpec[];
blankMigrationContent: string;
logger: Logger;
}
export declare function parseSettings(settings: Settings, requireShadow?: boolean): Promise<ParsedSettings>;
/**
* Overrides the databaseName in rootConnectionString and returns the resulting
* connection string.
*/
export declare function makeRootDatabaseConnectionString(parsedSettings: ParsedSettings, databaseName: string): string;