forked from Effect-TS/effect
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSqliteMigrator.ts
More file actions
33 lines (30 loc) · 825 Bytes
/
SqliteMigrator.ts
File metadata and controls
33 lines (30 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* @since 1.0.0
*/
import * as Migrator from "@effect/sql/Migrator"
import type * as Client from "@effect/sql/SqlClient"
import type { SqlError } from "@effect/sql/SqlError"
import type * as Effect from "effect/Effect"
import * as Layer from "effect/Layer"
/**
* @since 1.0.0
*/
export * from "@effect/sql/Migrator"
/**
* @category constructor
* @since 1.0.0
*/
export const run: <R>(
options: Migrator.MigratorOptions<R>
) => Effect.Effect<
ReadonlyArray<readonly [id: number, name: string]>,
SqlError | Migrator.MigrationError,
Client.SqlClient | R
> = Migrator.make({})
/**
* @category constructor
* @since 1.0.0
*/
export const layer = <R>(
options: Migrator.MigratorOptions<R>
): Layer.Layer<never, SqlError | Migrator.MigrationError, R | Client.SqlClient> => Layer.effectDiscard(run(options))