nulla/priv/repo/migrations/20250617091354_create_relations.exs
2025-06-17 12:06:36 +02:00

23 lines
662 B
Elixir

defmodule Nulla.Repo.Migrations.CreateActorRelations do
use Ecto.Migration
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
timestamps()
end
create index(:relations, [:source_id])
create index(:relations, [:target_id])
create index(:relations, [:type])
create index(:relations, [:activity_id])
create unique_index(:relations, [:source_id, :target_id, :type])
end
end