wiki/priv/repo/migrations/20200801233918_create_page_...

18 lines
506 B
Elixir

defmodule Wiki.Repo.Migrations.CreatePageLinks do
use Ecto.Migration
def change do
create table(:page_links) do
add :from_id, references(:pages, on_delete: :nothing), primary_key: true
add :to_id, references(:pages, on_delete: :nothing), primary_key: true
end
create index(:page_links, [:from_id])
create index(:page_links, [:to_id])
create unique_index(:page_links, [:from_id, :to_id],
name: :page_link_from_id_to_id_unique_index
)
end
end