-
Notifications
You must be signed in to change notification settings - Fork 46
Fix Follow System: Add missing follows table migration #486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| -- Add user follows table | ||
| CREATE TABLE follows ( | ||
| follower_id UUID REFERENCES profiles(id) ON DELETE CASCADE, | ||
| following_id UUID REFERENCES profiles(id) ON DELETE CASCADE, | ||
| created_at TIMESTAMPTZ DEFAULT NOW(), | ||
| PRIMARY KEY (follower_id, following_id), | ||
| CHECK (follower_id != following_id) | ||
| ); | ||
|
Comment on lines
+2
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The existing |
||
|
|
||
| CREATE INDEX idx_follows_follower ON follows(follower_id); | ||
| CREATE INDEX idx_follows_following ON follows(following_id); | ||
|
|
||
| ALTER TABLE follows ENABLE ROW LEVEL SECURITY; | ||
|
|
||
| CREATE POLICY "Follows are viewable by everyone" ON follows FOR SELECT USING (true); | ||
| CREATE POLICY "Users can manage their own follows" ON follows FOR ALL USING (auth.uid() = follower_id); | ||
|
Comment on lines
+15
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The policy |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
followstable was already created insupabase/migrations/20260201090000_follow_system.sql(line 5) usingCREATE TABLE IF NOT EXISTS follows. This new migration uses a bareCREATE TABLE followswith noIF NOT EXISTSguard, so when Supabase applies migrations sequentially it will hitERROR: relation "follows" already existsand abort, leaving the database in an inconsistent migration state. The PR description's premise that the table was missing is incorrect — it has existed since the Feb 1 migration.