feat(db): recipe_views table mit Profil-FK und Recent-Index
Tracking-Tabelle fuer Sort-Option Zuletzt angesehen. Composite-PK (profile_id, recipe_id) erlaubt INSERT OR REPLACE per Default-Timestamp. Index nach profile_id + last_viewed_at DESC fuer Sort-Query. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
8
src/lib/server/db/migrations/014_recipe_views.sql
Normal file
8
src/lib/server/db/migrations/014_recipe_views.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
CREATE TABLE recipe_views (
|
||||
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')),
|
||||
PRIMARY KEY (profile_id, recipe_id)
|
||||
);
|
||||
CREATE INDEX idx_recipe_views_recent
|
||||
ON recipe_views (profile_id, last_viewed_at DESC);
|
||||
Reference in New Issue
Block a user