parent
177067ab00
commit
9af0124138
11 changed files with 608 additions and 60 deletions
16
priv/repo/migrations/20200809220758_create_plans.exs
Normal file
16
priv/repo/migrations/20200809220758_create_plans.exs
Normal file
|
@ -0,0 +1,16 @@
|
|||
defmodule Planner.Repo.Migrations.CreatePlans do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:plans, primary_key: false) do
|
||||
add :id, :binary_id, primary_key: true
|
||||
add :description, :string
|
||||
add :finished_at, :naive_datetime
|
||||
add :start, :naive_datetime
|
||||
add :end, :naive_datetime
|
||||
add :name, :string
|
||||
|
||||
timestamps()
|
||||
end
|
||||
end
|
||||
end
|
18
priv/repo/migrations/20200809221238_create_plan_details.exs
Normal file
18
priv/repo/migrations/20200809221238_create_plan_details.exs
Normal file
|
@ -0,0 +1,18 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue