[#1335] Refactored UserMute and UserBlock into UserRelationship, introduced EctoEnum.

This commit is contained in:
Ivan Tashkinov 2019-11-18 20:38:56 +03:00
commit aad6576130
15 changed files with 239 additions and 317 deletions

View file

@ -0,0 +1,17 @@
defmodule Pleroma.Repo.Migrations.CreateUserRelationships do
use Ecto.Migration
def change do
create_if_not_exists table(:user_relationships) do
add(:source_id, references(:users, type: :uuid, on_delete: :delete_all))
add(:target_id, references(:users, type: :uuid, on_delete: :delete_all))
add(:relationship_type, :integer, null: false)
timestamps(updated_at: false)
end
create_if_not_exists(
unique_index(:user_relationships, [:source_id, :relationship_type, :target_id])
)
end
end