From 30303b34012f22cbe898dcebfd460709b206181d Mon Sep 17 00:00:00 2001
From: xengineering <me@xengineering.eu>
Date: Tue, 6 Feb 2024 19:58:49 +0100
Subject: model: Switch to very basic database schema

This simple model is used to test if it is helpful to implement the four
CRUD methods create, read, update and delete all inside the model
package.

The model package should also provide the datastructures for these
operations (well suited for the required views) aswell as tests for
them.

With this approach it should be possible to easily implement the view
and controller package because most of the logic is already inside the
model package and is tested.
---
 model/sql/migrate.sql | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

(limited to 'model/sql/migrate.sql')

diff --git a/model/sql/migrate.sql b/model/sql/migrate.sql
index 6ca4d0f..c548724 100644
--- a/model/sql/migrate.sql
+++ b/model/sql/migrate.sql
@@ -1,14 +1,9 @@
-CREATE TABLE 'recipes' (
-	'id' integer PRIMARY KEY AUTOINCREMENT,
-	'title' text DEFAULT '',
-	'portions' text DEFAULT '',  -- FIXME has to be integer
-	'url' text DEFAULT '',
-	'notes' text DEFAULT ''
-);
-
-CREATE TABLE 'recipe_steps' (
-	'id' integer PRIMARY KEY,
-	'recipe_id' integer DEFAULT NULL,
-	'rank' integer DEFAULT NULL,
-	'text' text DEFAULT ''
+CREATE TABLE recipes (
+	id           INTEGER PRIMARY KEY,
+	title        TEXT    NOT NULL,
+	portions     INTEGER NOT NULL,
+	url          TEXT    NOT NULL,
+	notes        TEXT    NOT NULL,
+	created      INTEGER NOT NULL, -- unix timestamp
+	last_changed INTEGER NOT NULL  -- unix timestamp
 );
-- 
cgit v1.3

