refactor(db): recipe_views -> recipe_view, TIMESTAMP-Konsistenz
Code-Review-Findings nachgezogen: Tabellen-Konvention im Repo ist singular (profile, recipe, favorite, cooking_log, thumbnail_cache), deshalb recipe_view statt recipe_views; Index analog umbenannt. last_viewed_at auf TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP gewechselt — matcht den Rest des Schemas. Header-Kommentar + notnull-Assertion fuer recipe_id ergaenzt. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
CREATE TABLE recipe_views (
|
||||
-- Merkt je Profil, wann ein Rezept zuletzt angesehen wurde.
|
||||
-- Dient als Basis fuer "Zuletzt gesehen"-Sortierung auf der Startseite.
|
||||
CREATE TABLE recipe_view (
|
||||
profile_id INTEGER NOT NULL REFERENCES profile(id) ON DELETE CASCADE,
|
||||
recipe_id INTEGER NOT NULL REFERENCES recipe(id) ON DELETE CASCADE,
|
||||
last_viewed_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
last_viewed_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (profile_id, recipe_id)
|
||||
);
|
||||
CREATE INDEX idx_recipe_views_recent
|
||||
ON recipe_views (profile_id, last_viewed_at DESC);
|
||||
CREATE INDEX idx_recipe_view_recent
|
||||
ON recipe_view (profile_id, last_viewed_at DESC);
|
||||
|
||||
Reference in New Issue
Block a user