Skip to main content

profile_links

Overview

The profile_links table stores external links that users can display in their HomeRoom. Each link has a title, URL, optional icon, and position ordering.

Schema

-- From 20260130_homeroom_foundation.sql
CREATE TABLE profile_links (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE,
title TEXT NOT NULL,
url TEXT NOT NULL,
icon TEXT,
position INTEGER DEFAULT 0,
created_at TIMESTAMPTZ DEFAULT NOW()
);

Columns

ColumnTypeNullableDefaultDescription
iduuidNogen_random_uuid()Primary key
user_iduuidNo--Link owner
titletextNo--Link display title
urltextNo--External URL
icontextYes--Icon identifier
positionintegerNo0Display order
created_attimestamptzNoNOW()Creation timestamp

RLS Policies

-- SELECT: Anyone can view profile links
CREATE POLICY "Profile links are publicly viewable"
ON profile_links FOR SELECT
USING (true);

-- INSERT/UPDATE/DELETE: Users manage their own links
CREATE POLICY "Users can manage own links"
ON profile_links FOR ALL
USING (auth.uid() = user_id);

Last updated: 2026-02-07