CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
0031_user_follows.sql
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 7aa8b99 | 1 | -- Block J4 — User following / follow-feed. |
| 2 | -- | |
| 3 | -- Directed graph of user -> user. Used to filter activity_feed into a | |
| 4 | -- personalised "what's happening in my network" view. | |
| 5 | ||
| 6 | CREATE TABLE IF NOT EXISTS "user_follows" ( | |
| 7 | "follower_id" uuid NOT NULL REFERENCES "users"("id") ON DELETE CASCADE, | |
| 8 | "following_id" uuid NOT NULL REFERENCES "users"("id") ON DELETE CASCADE, | |
| 9 | "created_at" timestamp NOT NULL DEFAULT now(), | |
| 10 | PRIMARY KEY ("follower_id", "following_id"), | |
| 11 | CONSTRAINT "user_follows_no_self" CHECK ("follower_id" <> "following_id") | |
| 12 | ); | |
| 13 | ||
| 14 | CREATE INDEX IF NOT EXISTS "user_follows_following_idx" | |
| 15 | ON "user_follows" ("following_id"); |