diff --git a/lib/planner/tasks/plan.ex b/lib/planner/tasks/plan.ex index f78a8db..5ddbf09 100644 --- a/lib/planner/tasks/plan.ex +++ b/lib/planner/tasks/plan.ex @@ -5,18 +5,15 @@ defmodule Planner.Tasks.Plan do @primary_key {:id, :binary_id, autogenerate: true} @foreign_key_type :binary_id schema "plans" do - field :description, :string field :finished_at, :naive_datetime - field :end, :naive_datetime field :name, :string - field :start, :naive_datetime timestamps() end def changeset(plan, attrs) do plan - |> cast(attrs, [:description, :finished_at, :start, :end, :name]) + |> cast(attrs, [:name, :finished_at]) |> validate_required([:name]) |> update_change(:name, &String.trim/1) end diff --git a/priv/repo/migrations/20201122013313_remove_unused_fields_from_plans.exs b/priv/repo/migrations/20201122013313_remove_unused_fields_from_plans.exs new file mode 100644 index 0000000..aae68b0 --- /dev/null +++ b/priv/repo/migrations/20201122013313_remove_unused_fields_from_plans.exs @@ -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