View Source migraterl (migraterl v0.1.2)

Library module.

Summary

Functions

A default connection, for local testing or CI.

Given a directory, applies only the files not already present on the migration. If the migration table does not yet exist, make sure to create it beforehand.

Types

directory/0

-type directory() :: file:name_all().

filename/0

-type filename() :: file:name_all().

mode/0

-type mode() :: setup | apply_once | repeat.

options/0

-type options() :: #{repeatable => boolean()}.

state/0

-type state() :: init | created.

version/0

-type version() :: non_neg_integer().

Functions

default_connection()

-spec default_connection() -> Result
                            when
                                Reason :: string(),
                                Error :: {error, Reason},
                                Result :: epgsql:connection() | Error.

A default connection, for local testing or CI.

migrate(Conn, Dir, Options)

-spec migrate(Conn, Dir, Options) -> Result
                 when
                     Conn :: epgsql:connection(),
                     Dir :: directory(),
                     Options :: options(),
                     Reason :: string(),
                     Error :: {error, Reason},
                     Result :: ok | Error.

Given a directory, applies only the files not already present on the migration. If the migration table does not yet exist, make sure to create it beforehand.