2026-04-22 14:08:17 +02:00
|
|
|
-- Merkt je Profil, wann ein Rezept zuletzt angesehen wurde.
|
|
|
|
|
-- Dient als Basis fuer "Zuletzt gesehen"-Sortierung auf der Startseite.
|
|
|
|
|
CREATE TABLE recipe_view (
|
2026-04-22 14:04:27 +02:00
|
|
|
profile_id INTEGER NOT NULL REFERENCES profile(id) ON DELETE CASCADE,
|
|
|
|
|
recipe_id INTEGER NOT NULL REFERENCES recipe(id) ON DELETE CASCADE,
|
2026-04-22 14:08:17 +02:00
|
|
|
last_viewed_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
2026-04-22 14:04:27 +02:00
|
|
|
PRIMARY KEY (profile_id, recipe_id)
|
|
|
|
|
);
|
2026-04-22 14:08:17 +02:00
|
|
|
CREATE INDEX idx_recipe_view_recent
|
|
|
|
|
ON recipe_view (profile_id, last_viewed_at DESC);
|