Skip to main content Link Search Menu Expand Document (external link)

Migrator overview

Added in v1.0.0


Table of contents


constructor

make

Signature

export declare const make: <RD = never>({
  dumpSchema
}: {
  dumpSchema?: (path: string, migrationsTable: string) => Effect.Effect<void, MigrationError, RD>
}) => <R2 = never>({
  loader,
  schemaDirectory,
  table
}: MigratorOptions<R2>) => Effect.Effect<
  ReadonlyArray<readonly [id: number, name: string]>,
  MigrationError | SqlError,
  Client.SqlClient | RD | R2
>

Added in v1.0.0

errors

MigrationError (class)

Signature

export declare class MigrationError

Added in v1.0.0

loaders

fromBabelGlob

Signature

export declare const fromBabelGlob: (migrations: Record<string, any>) => Loader

Added in v1.0.0

fromGlob

Signature

export declare const fromGlob: (migrations: Record<string, () => Promise<any>>) => Loader

Added in v1.0.0

model

Loader (type alias)

Signature

export type Loader<R = never> = Effect.Effect<ReadonlyArray<ResolvedMigration>, MigrationError, R>

Added in v1.0.0

Migration (interface)

Signature

export interface Migration {
  readonly id: number
  readonly name: string
  readonly createdAt: Date
}

Added in v1.0.0

MigratorOptions (interface)

Signature

export interface MigratorOptions<R = never> {
  readonly loader: Loader<R>
  readonly schemaDirectory?: string
  readonly table?: string
}

Added in v1.0.0

ResolvedMigration (type alias)

Signature

export type ResolvedMigration = readonly [id: number, name: string, load: Effect.Effect<any>]

Added in v1.0.0