Skip to content

egobrain/dbschema

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coveralls GitHub tag Hex.pm

Erlang PostgreSQL migrations utils


Description

Project is based on epgpool and epgsql. It supports sql and erl migrations description.

Usage

  1. Create migrations folder (for example, ./migrations)
  2. Create migration file with numeric prefix and .erl or .sql extension.
    The prefix must be unique monotonically increasing integer (1,2,3...).
    No dupplicates allowed!
  • In case of erl you need to implement dbschema_migration behaviour.
  • In case of sql you need to write your sql commands directly.
    And specify -- up and -- down comments to separate "up" migration part from "down"
  1. Run dbschema:up(MigrationDir) in you _app.erl start function.
  2. To downgrade call dbscheam:down(MigrationDir, PrefixNum)

Sql migration example

./migrations/1-init.sql

-- Up

create table test(
    id serial primary key,
    name text
);

-- Down

drop table test;

About

Erlang postgresql migrations util

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages