Changes
1. Add title column to plots table
ALTER TABLE plots ADD COLUMN title TEXT DEFAULT '';
- Default empty string for backward compatibility with existing plots
- Update Supabase TypeScript types in
lib/supabase.ts
- Update plot indexer (
/api/index/plot/route.ts) to extract title from PlotChained event
2. Create comments table
CREATE TABLE comments (
id SERIAL PRIMARY KEY,
storyline_id INTEGER NOT NULL REFERENCES storylines(storyline_id),
plot_index INTEGER NOT NULL, -- 0 = genesis, 1+ = chapter
commenter_address TEXT NOT NULL,
content TEXT NOT NULL,
created_at TIMESTAMPTZ DEFAULT NOW(),
hidden BOOLEAN DEFAULT FALSE
);
CREATE INDEX idx_comments_storyline_plot ON comments(storyline_id, plot_index);
CREATE INDEX idx_comments_commenter ON comments(commenter_address);
plot_index = 0 for comments on genesis
plot_index = N for comments on chapter N
hidden for moderation support
- Update Supabase TypeScript types
3. Create comments API routes
GET /api/comments?storylineId=X&plotIndex=Y&page=1&limit=20 — paginated fetch
POST /api/comments — create comment (requires wallet signature)
Blocked by
#184 (contract must be deployed first for title in events)
Part of
Phase 9 Epic (#183)
Changes
1. Add
titlecolumn toplotstablelib/supabase.ts/api/index/plot/route.ts) to extract title from PlotChained event2. Create
commentstableplot_index = 0for comments on genesisplot_index = Nfor comments on chapter Nhiddenfor moderation support3. Create comments API routes
GET /api/comments?storylineId=X&plotIndex=Y&page=1&limit=20— paginated fetchPOST /api/comments— create comment (requires wallet signature)Blocked by
#184 (contract must be deployed first for title in events)
Part of
Phase 9 Epic (#183)