erlang_migrate_source (erlang_migrate v0.3.4)

View Source

迁移文件 source / Migration file source — 扫描 {version}_{title}.up.sql/.down.sql 对,按版本升序返回(标题支持 UTF-8)。

Summary

Types

migration()

-type migration() ::
          #{version := integer(),
            title := binary(),
            up_file := file:filename(),
            down_file := file:filename() | undefined}.

Functions

read_sql(File, Direction)

-spec read_sql(File :: file:filename(), Direction :: up | down) -> {ok, binary()} | {error, term()}.

scan(Dir)

-spec scan(Dir :: file:filename()) -> {ok, [migration()]} | {error, term()}.