Current section

Files

Jump to
blossom lib blossom migrations postgres.ex
Raw

lib/blossom/migrations/postgres.ex

defmodule Blossom.Migrations.Postgres do
use Ecto.Migration
alias Blossom.Migrations.Postgres
@current_version 1
def change(range, direction) do
for index <- range do
pad_idx = String.pad_leading(Integer.to_string(index), 2, "0")
[__MODULE__, "V#{pad_idx}"]
|> Module.concat()
|> apply(direction, [[]])
end
end
def up() do
Postgres.change(1..@current_version, :up)
end
def down() do
Postgres.change(1..@current_version, :down)
end
end