2021-03-05 19:23:32 -05:00
|
|
|
defmodule Shift73k.Repo.Migrations.AddRoleToUsers do
|
2020-09-12 20:14:06 -04:00
|
|
|
use Ecto.Migration
|
|
|
|
|
2021-03-05 19:23:32 -05:00
|
|
|
alias Shift73k.Accounts.User.RolesEnum
|
2020-09-12 20:14:06 -04:00
|
|
|
|
|
|
|
def up do
|
|
|
|
RolesEnum.create_type()
|
|
|
|
|
|
|
|
alter table(:users) do
|
2021-02-24 07:49:39 -05:00
|
|
|
add(:role, RolesEnum.type(), null: false)
|
2020-09-12 20:14:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down do
|
|
|
|
alter table(:users) do
|
2021-02-24 07:49:39 -05:00
|
|
|
remove(:role)
|
2020-09-12 20:14:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
RolesEnum.drop_type()
|
|
|
|
end
|
|
|
|
end
|