Simple utility to add migrations for Erlang projects. It doesn't have any database abstraction, you'll still operate with plain SQL and it only supports PostgreSQL (using pgsql or epgsql library). Inspired by erlang-sql-migrations by spawngrid.
In order to use the tool one writes 'migration' files. Most important thing here is to name in the order of their versioning, like this: [timestamp]_name.sql
.
-- priv/migrations/1423733547_users.sql
-- :up
CREATE TABLE users();
-- :down
DROP TABLE users;
pgsql_migration:migrate(Conn, "priv/migrations").
You can rename pgsql driver, if you use epgsql 3.0 or newer:
pgsql_migration:use_driver(epgsql).
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request