Migrator
Constructor
Signature
declare function make<RD = never>(__namedParameters: {
dumpSchema?: (path: string, migrationsTable: string) => Effect<void, MigrationError, RD>;
}): <R2 = never>(__namedParameters: MigratorOptions<R2>) => Effect<readonly Array<readonly [number, string]>, MigrationError | SqlError, SqlClient | RD | R2>Errors
MigrationError
Added in v1.0.0
Source
Signature
declare class MigrationError extends YieldableError<this> & {
readonly _tag: "MigrationError";
} & Readonly<{
readonly _tag: "MigrationError";
readonly cause?: unknown;
readonly message: string;
readonly reason: "bad-state" | "import-error" | "failed" | "duplicates" | "locked";
}> {
constructor(args: {
readonly cause?: unknown;
readonly message: string;
readonly reason: "bad-state" | "import-error" | "failed" | "duplicates" | "locked";
});
}Loaders
fromBabelGlob
Added in v1.0.0
Source
Signature
declare function fromBabelGlob(migrations: Record<string, any>): Loader;Signature
declare function fromGlob(migrations: Record<string, () => Promise<any>>): Loader;fromRecord
Added in v1.0.0
Source
Signature
declare function fromRecord(
migrations: Record<string, Effect.Effect<void, unknown, Client.SqlClient>>,
): Loader;Model
Signature
type Loader<R = never> = Effect.Effect<ReadonlyArray<ResolvedMigration>, MigrationError, R>;Signature
interface Migration {
readonly createdAt: Date;
readonly id: number;
readonly name: string;
}MigratorOptions interface
Added in v1.0.0
Source
Signature
interface MigratorOptions<R = never> {
readonly loader: Loader<R>;
readonly schemaDirectory?: string;
readonly table?: string;
}ResolvedMigration type
Added in v1.0.0
Source
Signature
type ResolvedMigration = readonly [
id: number,
name: string,
load: Effect.Effect<any, any, Client.SqlClient>,
];