Add relations
This commit is contained in:
parent
f43b4bd038
commit
3a57d74357
12 changed files with 81 additions and 85 deletions
|
@ -4,20 +4,28 @@ defmodule Nulla.Repo.Migrations.CreateActorRelations do
|
|||
def change do
|
||||
create table(:relations, primary_key: false) do
|
||||
add :id, :bigint, primary_key: true
|
||||
add :source_id, :bigint, null: false
|
||||
add :target_id, :bigint, null: false
|
||||
add :type, :string, null: false
|
||||
add :status, :string, null: false
|
||||
add :activity_id, :bigint
|
||||
add :following, :boolean, null: false, default: false
|
||||
add :followed_by, :boolean, null: false, default: false
|
||||
add :showing_replies, :boolean, null: false, default: true
|
||||
add :showing_reblogs, :boolean, null: false, default: true
|
||||
add :notifying, :boolean, null: false, default: false
|
||||
add :muting, :boolean, null: false, default: false
|
||||
add :muting_notifications, :boolean, null: false, default: false
|
||||
add :blocking, :boolean, null: false, default: false
|
||||
add :blocked_by, :boolean, null: false, default: false
|
||||
add :domain_blocking, :boolean, null: false, default: false
|
||||
add :requested, :boolean, null: false, default: false
|
||||
add :note, :string
|
||||
|
||||
add :local_actor_id, references(:actors, type: :bigint), null: false
|
||||
add :remote_actor_id, references(:actors, type: :bigint), null: false
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index(:relations, [:source_id])
|
||||
create index(:relations, [:target_id])
|
||||
create index(:relations, [:type])
|
||||
create index(:relations, [:activity_id])
|
||||
create index(:relations, [:local_actor_id])
|
||||
create index(:relations, [:remote_actor_id])
|
||||
|
||||
create unique_index(:relations, [:source_id, :target_id, :type])
|
||||
create unique_index(:relations, [:local_actor_id, :remote_actor_id])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue