Skip to content

[DB] Create share_links table with RLS policies #18

@Venkat-Kolasani

Description

@Venkat-Kolasani

What

Add a share_links table to Supabase with proper Row Level Security.

Schema

Column Type Notes
id uuid Primary key
user_id uuid FK to auth.users
token uuid Public-facing, generated server-side
snapshot jsonb Frozen or live config
snapshot_type enum 'frozen' or 'live'
expires_at timestamptz Nullable
is_active boolean Default true
view_count integer Default 0
created_at timestamptz Default now()

RLS Rules

  • Authenticated users can INSERT/UPDATE/DELETE only their own rows (user_id = auth.uid())
  • Public (anon) can SELECT only by token column — never expose user_id in response

Acceptance Criteria

  • Migration SQL file added under /supabase/migrations/
  • RLS enabled and policies tested
  • Anon select works by token, returns no user_id field

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions