The Blueprint
Database Schema
The living blueprint of our sanctuary. Every table, every relationship, every column—always accurate, always transparent.
Row Level SecurityPostgreSQL✓Auto-generated
Core Tables
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| id | UUID | ✗ | Primary key, references auth.users |
| username | TEXT | ✓ | Unique public handle |
| display_name | TEXT | ✓ | Name shown in UI |
| avatar_url | TEXT | ✓ | Profile picture URL |
| banner_url | TEXT | ✓ | Profile header image |
| bio | TEXT | ✓ | User description |
| is_creator | BOOLEAN | ✓ | Can list products |
| is_vendor | BOOLEAN | ✓ | Can sell services |
| is_admin | BOOLEAN | ✓ | Full system access |
| user_tier | user_tier | ✓ | community | ally | corporate | council |
| sovereignty_score | INTEGER | ✓ | Points earned through participation |
| primary_house | council_house | ✓ | Affiliated council house |
| residual_pledge_percent | INTEGER | ✓ | 50% Covenant pledge amount |
| created_at | TIMESTAMPTZ | ✓ | Account creation timestamp |
Relationships
profiles.id→creator_profiles.idone-to-one
profiles.id→vendor_profiles.idone-to-one
profiles.id→community_profiles.idone-to-one
profiles.id→products.creator_idone-to-many
profiles.id→sales.buyer_idone-to-many
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| id | UUID | ✗ | Primary key |
| creator_id | UUID | ✗ | References profiles.id |
| title | TEXT | ✗ | Product name |
| description | TEXT | ✓ | Product details |
| product_type | product_type | ✗ | digital_course, physical_product, etc. |
| price_community | DECIMAL | ✓ | Discounted price for community tier |
| price_ally | DECIMAL | ✗ | Standard price |
| price_corporate | DECIMAL | ✓ | Premium price |
| residual_pool_percent | INTEGER | ✓ | Percentage to contributors |
| is_published | BOOLEAN | ✓ | Visible to public |
| created_at | TIMESTAMPTZ | ✓ | Listing date |
Relationships
products.creator_id→profiles.idmany-to-one
products.id→sales.product_idone-to-many
products.id→contributions.product_idone-to-many
Enumerated Types
Row Level Security (RLS)
Every table has Row Level Security enabled. Users can only access their own data. Admins have elevated access. All policies are public and auditable.