module_styles
Overview
The module_styles table stores CSS customization for individual HomeRoom modules. Each module can have its own font, color, border, and shadow settings that override the room-level styles.
Schema
-- From 20260202_room_styles.sql
CREATE TABLE module_styles (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
module_id UUID NOT NULL REFERENCES home_room_modules(id) ON DELETE CASCADE UNIQUE,
background_color TEXT,
text_color TEXT,
border_style TEXT,
border_color TEXT,
border_width TEXT,
border_radius TEXT,
shadow TEXT,
padding TEXT,
font_family TEXT,
font_size TEXT,
opacity NUMERIC(3,2) DEFAULT 1.0,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);
Columns
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | uuid | No | gen_random_uuid() | Primary key |
module_id | uuid | No | -- | Parent module (unique per module) |
background_color | text | Yes | -- | Module background color |
text_color | text | Yes | -- | Module text color |
border_style | text | Yes | -- | Border style |
border_color | text | Yes | -- | Border color |
border_width | text | Yes | -- | Border width |
border_radius | text | Yes | -- | Border radius |
shadow | text | Yes | -- | Box shadow |
padding | text | Yes | -- | Internal padding |
font_family | text | Yes | -- | Font family override |
font_size | text | Yes | -- | Font size override |
opacity | numeric(3,2) | No | 1.0 | Module opacity |
created_at | timestamptz | No | NOW() | Creation timestamp |
updated_at | timestamptz | No | NOW() | Last update timestamp |
RLS Policies
-- SELECT: Anyone can view module styles
CREATE POLICY "Module styles are publicly viewable"
ON module_styles FOR SELECT
USING (true);
-- INSERT/UPDATE: Room owner can manage module styles
CREATE POLICY "Room owner can manage module styles"
ON module_styles FOR ALL
USING (EXISTS (
SELECT 1 FROM home_room_modules
JOIN home_room_settings ON home_room_settings.id = home_room_modules.room_id
WHERE home_room_modules.id = module_styles.module_id
AND home_room_settings.user_id = auth.uid()
));
Related
- home_room_modules -- Parent module
- room_styles -- Room-level style defaults
Last updated: 2026-02-07