planner/priv/repo/migrations/20200809221238_create_plan_details.exs
2020-08-23 15:19:10 -07:00

18 lines
563 B
Elixir

defmodule Planner.Repo.Migrations.CreatePlanDetails do
use Ecto.Migration
def change do
create table(:plan_details, primary_key: false) do
add :id, :binary_id, primary_key: true
add :sort, :integer
add :task_id, references(:tasks, on_delete: :nothing, type: :binary_id)
add :plan_id, references(:plans, on_delete: :nothing, type: :binary_id)
timestamps()
end
create index(:plan_details, [:task_id])
create index(:plan_details, [:plan_id])
create unique_index(:plan_details, [:task_id, :plan_id])
end
end