Update schema.sql
This commit is contained in:
parent
c912663c3d
commit
e160357256
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
|
my-recipes-chart/
|
||||||
@ -16,11 +16,11 @@ CREATE TABLE IF NOT EXISTS recipes (
|
|||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
meal_type TEXT NOT NULL, -- breakfast / lunch / dinner / snack
|
meal_type TEXT NOT NULL, -- breakfast / lunch / dinner / snack
|
||||||
time_minutes INTEGER NOT NULL,
|
time_minutes INTEGER NOT NULL,
|
||||||
made_by TEXT, -- Person who created this recipe version
|
tags TEXT[] NOT NULL DEFAULT '{}', -- {"מהיר", "בריא"}
|
||||||
tags JSONB NOT NULL DEFAULT '[]', -- ["מהיר", "בריא"]
|
ingredients TEXT[] NOT NULL DEFAULT '{}', -- {"ביצה", "עגבניה", "מלח"}
|
||||||
ingredients JSONB NOT NULL DEFAULT '[]', -- ["ביצה", "עגבניה", "מלח"]
|
steps TEXT[] NOT NULL DEFAULT '{}', -- {"לחתוך", "לבשל", ...}
|
||||||
steps JSONB NOT NULL DEFAULT '[]', -- ["לחתוך", "לבשל", ...]
|
|
||||||
image TEXT, -- Base64-encoded image or image URL
|
image TEXT, -- Base64-encoded image or image URL
|
||||||
|
made_by TEXT, -- Person who created this recipe version
|
||||||
user_id INTEGER REFERENCES users(id) ON DELETE SET NULL, -- Recipe owner
|
user_id INTEGER REFERENCES users(id) ON DELETE SET NULL, -- Recipe owner
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
);
|
);
|
||||||
@ -35,9 +35,7 @@ CREATE INDEX IF NOT EXISTS idx_recipes_time_minutes
|
|||||||
CREATE INDEX IF NOT EXISTS idx_recipes_made_by
|
CREATE INDEX IF NOT EXISTS idx_recipes_made_by
|
||||||
ON recipes (made_by);
|
ON recipes (made_by);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_recipes_tags_jsonb
|
CREATE INDEX IF NOT EXISTS idx_recipes_user_id
|
||||||
ON recipes USING GIN (tags);
|
ON recipes (user_id);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_recipes_ingredients_jsonb
|
|
||||||
ON recipes USING GIN (ingredients);
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user