Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Provides PostgreSQL schema patterns for InsForge: social graphs, e-commerce, content publishing, and multi-tenancy with RLS policies.
59% 91%+32 ptsof test cases passed
Passed 20 of 22 test cases with the skill, and 13 of 22 without it.
3 of 3 safety checks passed
Not used yet
Expert patterns for designing PostgreSQL schemas optimized for InsForge's PostgREST backend.
Use when: Building social features like Twitter, Instagram, LinkedIn connections
Schema:
CREATE TABLE follows (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
follower_id UUID REFERENCES users(id) ON DELETE CASCADE,
following_id UUID REFERENCES users(id) ON DELETE CASCADE,
created_at TIMESTAMPTZ DEFAULT NOW(),
UNIQUE(follower_id, following_id)
);
-- Index for fast lookups
CREATE INDEX idx_follows_follower ON follows(follower_id);
CREATE INDEX idx_follows_following ON follows(following_id);
-- RLS: Users can read all follows but only create their own
ALTER TABLE follows ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Anyone can read follows" ON follows
FOR SELECT USING (true);
CREATE POLICY "Users can follow others" ON follows
FOR INSERT
TO authenticated
WITH CHECK (uid() = follower_id);
CREATE POLICY "Users can unfollow" ON follows
FOR DELETE
TO authenticated
USING (uid() = follower_id);
Query with InsForge SDK:
Next to this one in the catalogue, plus more from the same author.