From 264484c256891a320dbc3c36e129e496431d7bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 4 Apr 2025 21:20:14 +0200 Subject: [PATCH] feat: add persistence for task --- flake.nix | 2 ++ lib/putzplan/tasks/task.ex | 5 +++++ .../migrations/20250404184442_add_task_relation.exs | 11 +++++++++++ 3 files changed, 18 insertions(+) create mode 100644 priv/repo/migrations/20250404184442_add_task_relation.exs diff --git a/flake.nix b/flake.nix index b11a8f6..779cd52 100644 --- a/flake.nix +++ b/flake.nix @@ -19,6 +19,8 @@ lexical beam.packages.erlang_25.elixir-ls next-ls + + sqlite ] ++ lib.optionals stdenv.isLinux [ # For ExUnit Notifier on Linux. diff --git a/lib/putzplan/tasks/task.ex b/lib/putzplan/tasks/task.ex index 1b0b9f8..aed1bb8 100644 --- a/lib/putzplan/tasks/task.ex +++ b/lib/putzplan/tasks/task.ex @@ -14,6 +14,11 @@ defmodule Putzplan.Tasks.Task do end end + sqlite do + table "tasks" + repo Putzplan.Repo + end + # Attributes are the simple pieces of data that exist on your resource attributes do # Add an autogenerated UUID primary key called `:id`. diff --git a/priv/repo/migrations/20250404184442_add_task_relation.exs b/priv/repo/migrations/20250404184442_add_task_relation.exs new file mode 100644 index 0000000..7e329c6 --- /dev/null +++ b/priv/repo/migrations/20250404184442_add_task_relation.exs @@ -0,0 +1,11 @@ +defmodule Putzplan.Repo.Migrations.AddTaskRelation do + use Ecto.Migration + + def change do + create table(:tasks, primary_key: false) do + add :id, :uuid, null: false, primary_key: true + add :description, :string, null: false + add :repetition_days, :integer, null: false + end + end +end