View Source migraterl (migraterl v0.0.1)

Library module.

Summary

Functions

A default connection, for local testing or CI.

Creates the required migraterl tables on the Database.

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().

version/0

-type version() :: non_neg_integer().

Functions

default_connection()

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

A default connection, for local testing or CI.

init(Conn)

-spec init(Conn :: epgsql:connection()) -> Result
              when Error :: {error, any(), any()}, Result :: ok | Error.

Creates the required migraterl tables on the Database.

migrate(Conn, Dir)

-spec migrate(Conn :: epgsql:connection(), Dir :: directory()) -> Result
                 when Error :: {error, any(), any()}, 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.