feat(wishlist): add shared family wishlist with likes
Each recipe appears at most once on the wishlist. Any profile can add,
remove, like, and unlike. Ratings and cooking log stay independent.
Data model: wishlist(recipe_id PK, added_by_profile_id, added_at)
wishlist_like(recipe_id, profile_id, created_at)
Why: 'das will ich essen' — family members pick candidates, everyone
can +1 to signal agreement, cook decides based on popularity.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
19
src/lib/server/db/migrations/002_wishlist.sql
Normal file
19
src/lib/server/db/migrations/002_wishlist.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- Shared family wishlist: recipes someone wants to cook next.
|
||||
-- Each recipe appears at most once; anyone can add/remove and like/unlike.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS wishlist (
|
||||
recipe_id INTEGER PRIMARY KEY REFERENCES recipe(id) ON DELETE CASCADE,
|
||||
added_by_profile_id INTEGER REFERENCES profile(id) ON DELETE SET NULL,
|
||||
added_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS ix_wishlist_added_at ON wishlist(added_at DESC);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS wishlist_like (
|
||||
recipe_id INTEGER NOT NULL REFERENCES recipe(id) ON DELETE CASCADE,
|
||||
profile_id INTEGER NOT NULL REFERENCES profile(id) ON DELETE CASCADE,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (recipe_id, profile_id)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS ix_wishlist_like_recipe ON wishlist_like(recipe_id);
|
||||
Reference in New Issue
Block a user