PgMigrator.ts
PgMigrator.ts overview
Section titled “PgMigrator.ts overview”Runs database migrations for PostgreSQL projects that use Effect SQL.
This module reuses the shared SQL migrator and connects it to PostgreSQL. It
exposes the common migration helpers and adds run and layer functions
that apply pending migration files with the current SQL client. When schema
dumps are requested, it uses pg_dump and the usual process and filesystem
services.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”constructors
Section titled “constructors”Runs PostgreSQL SQL migrations using the configured clients. Schema dumps use pg_dump and require child process, filesystem, and path services.
Signature
declare const run: <R2 = never>( options: Migrator.MigratorOptions<R2>) => Effect.Effect< ReadonlyArray<readonly [id: number, name: string]>, Migrator.MigrationError | SqlError, SqlClient | PgClient | ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem | Path.Path | R2>Since v4.0.0
layers
Section titled “layers”Creates a layer that runs PostgreSQL migrations during layer construction, including pg_dump-based schema dump support when requested.
Signature
declare const layer: <R>( options: Migrator.MigratorOptions<R>) => Layer.Layer< never, Migrator.MigrationError | SqlError, SqlClient | PgClient | ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem | Path.Path | R>Since v4.0.0
“effect/unstable/sql/Migrator” (namespace export)
Section titled ““effect/unstable/sql/Migrator” (namespace export)”Re-exports all named exports from the “effect/unstable/sql/Migrator” module.
Signature
export * from "effect/unstable/sql/Migrator"Since v4.0.0