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

18 lines
512 B
Elixir
Raw Permalink Normal View History

2020-08-02 20:12:38 +00:00
defmodule Wiki.Repo.Migrations.CreatePageLinks do
use Ecto.Migration
def change do
create table(:page_links) do
2020-08-02 21:46:18 +00:00
add :from_id, references(:pages, on_delete: :delete_all), primary_key: true
add :to_id, references(:pages, on_delete: :delete_all), primary_key: true
2020-08-02 20:12:38 +00:00
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