From f843754b53e7045b54019feebd398a27e333c544 Mon Sep 17 00:00:00 2001 From: dvirlabs Date: Mon, 8 Dec 2025 07:22:56 +0200 Subject: [PATCH] Update db-schema of my-recipes app --- .../templates/db-schema-configmap.yaml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/charts/my-recipes-chart/templates/db-schema-configmap.yaml b/charts/my-recipes-chart/templates/db-schema-configmap.yaml index 85b798b..c4b18be 100644 --- a/charts/my-recipes-chart/templates/db-schema-configmap.yaml +++ b/charts/my-recipes-chart/templates/db-schema-configmap.yaml @@ -5,6 +5,18 @@ metadata: namespace: {{ .Values.global.namespace }} data: schema.sql: | + -- Create users table + CREATE TABLE IF NOT EXISTS users ( + id SERIAL PRIMARY KEY, + username TEXT UNIQUE NOT NULL, + email TEXT UNIQUE NOT NULL, + password_hash TEXT NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ); + + CREATE INDEX IF NOT EXISTS idx_users_username ON users (username); + CREATE INDEX IF NOT EXISTS idx_users_email ON users (email); + -- Create recipes table CREATE TABLE IF NOT EXISTS recipes ( id SERIAL PRIMARY KEY, @@ -15,7 +27,9 @@ data: tags JSONB NOT NULL DEFAULT '[]', -- ["מהיר", "בריא"] ingredients JSONB NOT NULL DEFAULT '[]', -- ["ביצה", "עגבניה", "מלח"] steps JSONB NOT NULL DEFAULT '[]', -- ["לחתוך", "לבשל", ...] - image TEXT -- Base64-encoded image or image URL + image TEXT, -- Base64-encoded image or image URL + user_id INTEGER REFERENCES users(id) ON DELETE SET NULL, -- Recipe owner + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); -- Optional: index for filters