Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/artemeff/pgsql_migration
PostgreSQL migrations for Erlang
https://github.com/artemeff/pgsql_migration
Last synced: about 1 month ago
JSON representation
PostgreSQL migrations for Erlang
- Host: GitHub
- URL: https://github.com/artemeff/pgsql_migration
- Owner: artemeff
- License: mit
- Created: 2015-02-12T07:52:56.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-01-20T21:50:38.000Z (almost 2 years ago)
- Last Synced: 2024-08-04T01:15:21.670Z (4 months ago)
- Language: Erlang
- Homepage:
- Size: 7.81 KB
- Stars: 19
- Watchers: 2
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- beamtoolbox - [erl
- awesome-erlang - pgsql_migration
README
### 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](https://github.com/spawngrid/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`.
```sql
-- priv/migrations/1423733547_users.sql
-- :up
CREATE TABLE users();-- :down
DROP TABLE users;
``````erlang
pgsql_migration:migrate(Conn, "priv/migrations").
```You can rename pgsql driver, if you use [epgsql](https://github.com/epgsql/epgsql) 3.0 or newer:
```erlang
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