mobilizon/priv/repo/migrations/20180816093446_add_primary_key_to_member.exs
Thomas Citharel 559c889f1b Rename project to Mobilizon
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2018-10-11 17:37:39 +02:00

20 lines
591 B
Elixir

defmodule Mobilizon.Repo.Migrations.AddPrimaryKeyToMember do
use Ecto.Migration
def up do
execute("ALTER TABLE members DROP CONSTRAINT IF EXISTS members_pkey")
drop_if_exists index(:members, ["members_account_id_index"])
create unique_index(:members, [:actor_id, :parent_id], name: :members_actor_parent_unique_index)
alter table(:members) do
add :id, :serial, primary_key: true
end
end
def down do
drop index(:members, [:actor_id, :parent_id], name: :members_actor_parent_unique_index)
alter table(:members) do
remove :id
end
end
end