• Stars
    star
    19
  • Rank 1,124,267 (Top 23 %)
  • Language
    Erlang
  • License
    MIT License
  • Created about 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PostgreSQL migrations for Erlang

PostgreSQL migrations for Erlang


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.


Use

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

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request