summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20191108161911_create_user_blocks.exs
blob: c882d2bd696eafb0f6302e7dda7d90c6701e2528 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
defmodule Pleroma.Repo.Migrations.CreateUserBlocks do
  use Ecto.Migration

  def change do
    create_if_not_exists table(:user_blocks) do
      add(:blocker_id, references(:users, type: :uuid, on_delete: :delete_all))
      add(:blockee_id, references(:users, type: :uuid, on_delete: :delete_all))

      timestamps(updated_at: false)
    end

    create_if_not_exists(unique_index(:user_blocks, [:blocker_id, :blockee_id]))
  end
end