View Source migraterl_scanner (migraterl v0.5.0)

Filesystem scanning for migration scripts.

Reads each configured source directory, keeps only .sql files, orders them lexically, and computes a content hash for each. The result feeds the pure diff engine in migraterl_plan.

Summary

Functions

Read the bundled system migrations that bootstrap the journal.

Scan every configured source, returning the discovered scripts in application order (sources in the order given; files lexically sorted within each source).

Types

namespace()

-type namespace() :: binary().

script_class()

-type script_class() :: once | on_change | always.

Functions

read_system_migrations()

-spec read_system_migrations() -> {ok, [file:filename_all()]} | {error, term()}.

Read the bundled system migrations that bootstrap the journal.

scan(Namespace, Sources)

-spec scan(Namespace, Sources) -> Result
              when
                  Namespace :: namespace(),
                  Sources :: [{script_class(), file:filename_all()}],
                  Result ::
                      {ok,
                       [#script{namespace :: namespace(),
                                name :: binary(),
                                path :: file:filename_all(),
                                class :: script_class(),
                                order :: non_neg_integer(),
                                hash :: binary(),
                                sql :: binary()}]} |
                      {error, term()}.

Scan every configured source, returning the discovered scripts in application order (sources in the order given; files lexically sorted within each source).