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>) | undefined
}) => <R2 = never>({
  loader,
  schemaDirectory,
  table
}: MigratorOptions<R2>) => Effect.Effect<
  readonly (readonly [id: number, name: string])[],
  MigrationError | SqlError,
  RD | R2 | Client.Client
>

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>
) => Effect.Effect<readonly ResolvedMigration[], MigrationError, R>

Added in v1.0.0

fromFileSystem

Signature

export declare const fromFileSystem: (
  directory: string
) => Effect.Effect<readonly ResolvedMigration[], MigrationError, R>

Added in v1.0.0

fromGlob

Signature

export declare const fromGlob: (
  migrations: Record<string, () => Promise<any>>
) => Effect.Effect<readonly ResolvedMigration[], MigrationError, R>

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