remove unused plans fields (#59)
This commit is contained in:
parent
404caad2ac
commit
4601a6dc2d
2 changed files with 12 additions and 4 deletions
|
@ -5,18 +5,15 @@ defmodule Planner.Tasks.Plan do
|
||||||
@primary_key {:id, :binary_id, autogenerate: true}
|
@primary_key {:id, :binary_id, autogenerate: true}
|
||||||
@foreign_key_type :binary_id
|
@foreign_key_type :binary_id
|
||||||
schema "plans" do
|
schema "plans" do
|
||||||
field :description, :string
|
|
||||||
field :finished_at, :naive_datetime
|
field :finished_at, :naive_datetime
|
||||||
field :end, :naive_datetime
|
|
||||||
field :name, :string
|
field :name, :string
|
||||||
field :start, :naive_datetime
|
|
||||||
|
|
||||||
timestamps()
|
timestamps()
|
||||||
end
|
end
|
||||||
|
|
||||||
def changeset(plan, attrs) do
|
def changeset(plan, attrs) do
|
||||||
plan
|
plan
|
||||||
|> cast(attrs, [:description, :finished_at, :start, :end, :name])
|
|> cast(attrs, [:name, :finished_at])
|
||||||
|> validate_required([:name])
|
|> validate_required([:name])
|
||||||
|> update_change(:name, &String.trim/1)
|
|> update_change(:name, &String.trim/1)
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
defmodule Planner.Repo.Migrations.RemoveUnusedFieldsFromPlans do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
alter table(:plans) do
|
||||||
|
remove(:start)
|
||||||
|
remove(:end)
|
||||||
|
remove(:description)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue