X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=priv%2Frepo%2Fmigrations%2F20190315101315_create_registrations.exs;h=d705a499e4a692ab75027d66fdb4ee2edadd5d77;hb=9a9121805ceccfa62c77e9abc81af5f7c7fd4049;hp=dac86b7805ddbe77532e68e521339c14c60ee056;hpb=26b63540953f6a65bb52531b434fd6ab85aaedfe;p=akkoma diff --git a/priv/repo/migrations/20190315101315_create_registrations.exs b/priv/repo/migrations/20190315101315_create_registrations.exs index dac86b780..d705a499e 100644 --- a/priv/repo/migrations/20190315101315_create_registrations.exs +++ b/priv/repo/migrations/20190315101315_create_registrations.exs @@ -2,15 +2,17 @@ defmodule Pleroma.Repo.Migrations.CreateRegistrations do use Ecto.Migration def change do - create table(:registrations) do - add :user_id, references(:users, type: :uuid, on_delete: :delete_all) - add :provider, :string - add :uid, :string - add :info, :map, default: %{} + create_if_not_exists table(:registrations, primary_key: false) do + add(:id, :uuid, primary_key: true) + add(:user_id, references(:users, type: :uuid, on_delete: :delete_all)) + add(:provider, :string) + add(:uid, :string) + add(:info, :map, default: %{}) timestamps() end - create unique_index(:registrations, [:provider, :uid]) + create_if_not_exists(unique_index(:registrations, [:provider, :uid])) + create_if_not_exists(unique_index(:registrations, [:user_id, :provider, :uid])) end end