Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
community(mark): add community_message_mark table + migration (mark foundation)
Gus900259734fb3
diff --git a/src/shared/src/db/community-schema.ts b/src/shared/src/db/community-schema.tsindex 802606c57..83674b068 100644--- a/src/shared/src/db/community-schema.ts+++ b/src/shared/src/db/community-schema.ts@@ -598,3 +598,34 @@ export const communityBotDailyActivity = sqliteTable((t) => [primaryKey({ columns: [t.botId, t.day] })]);+// 23. community_message_mark+// Per-user private bookmark ("mark") on a message. Unlike community_pin (15),+// which is channel-shared (everyone sees the same set), a mark is keyed by the+// marking USER and visible only to them. Powers the Marked inbox tab. Like+// pins, no denormalized seq: the marked-list read joins communityMessage for+// the jump key (communityMessage.seq). channelId is stored for the cascade and+// the phase-2 per-channel markedIds read (inline glyph, cut from phase-1 per+// Gus /Gus/working #992); the INDEX(userId, channelId) that read needs is+// deferred with it. UNIQUE(userId, messageId) makes the toggle idempotent+// (messageId is globally unique, so channelId is not needed for uniqueness).+export const communityMessageMark = sqliteTable(+ "community_message_mark",+ {+ id: text("id").primaryKey().$defaultFn(() => nanoid()),+ userId: text("user_id")+ .notNull()+ .references(() => user.id, { onDelete: "cascade" }),+ channelId: text("channel_id")+ .notNull()+ .references(() => communityChannel.id, { onDelete: "cascade" }),+ messageId: text("message_id")+ .notNull()+ .references(() => communityMessage.id, { onDelete: "cascade" }),+ createdAt: text("created_at").notNull().$defaultFn(() => new Date().toISOString()),+ },+ (t) => [+ unique("uq_mark_user_message").on(t.userId, t.messageId),+ index("idx_mark_user_created").on(t.userId, t.createdAt),+ ]+);+diff --git a/src/web/migrations/0078_community_message_mark.sql b/src/web/migrations/0078_community_message_mark.sqlnew file mode 100644index 000000000..f0649fc77--- /dev/null+++ b/src/web/migrations/0078_community_message_mark.sql@@ -0,0 +1,26 @@+-- Per-user private message bookmark ("mark"), powering the Marked inbox tab+-- (Gus /Gus/uiux #306). Unlike community_pin, which is channel-shared, a mark is+-- keyed by the marking USER and visible only to them. No denormalized seq: the+-- marked-list read joins community_message for the jump key (community_message.seq),+-- exactly as the pins route does. channel_id is stored for the cascade and the+-- phase-2 per-channel markedIds read (the inline glyph, cut from phase-1 per Gus+-- #992); the INDEX(user_id, channel_id) that read needs is deferred with it.+--+-- UNIQUE(user_id, message_id) makes the toggle idempotent: mark-again is an+-- onConflictDoNothing no-op, not a duplicate row. message_id is globally unique,+-- so channel_id is not part of the uniqueness key. All three FKs cascade on+-- delete so a removed user / channel / message takes its marks with it.+CREATE TABLE community_message_mark (+ id TEXT PRIMARY KEY NOT NULL,+ user_id TEXT NOT NULL REFERENCES user(id) ON DELETE CASCADE,+ channel_id TEXT NOT NULL REFERENCES community_channel(id) ON DELETE CASCADE,+ message_id TEXT NOT NULL REFERENCES community_message(id) ON DELETE CASCADE,+ created_at TEXT NOT NULL+);++CREATE UNIQUE INDEX uq_mark_user_message+ ON community_message_mark(user_id, message_id);++-- Marked-list read: this user's marks, newest-first.+CREATE INDEX idx_mark_user_created+ ON community_message_mark(user_id, created_at);