link,[object Object]
Skip to content

Database Schema ​

This is the entry point for the data model documentation. It links to domain documents and avoids duplication.

Overview ​

AcqMarketplace uses PostgreSQL via Supabase with comprehensive Row Level Security (RLS), realtime, and multilingual support.

Contents ​

  • Tables by domain: see ./tables.md
  • Views: see ./views.md
  • Enums: see ./enums.md
  • RPC functions: see ./rpc.md
  • Permissions & Roles: see ./permissions.md

Highlights ​

  • Full i18n (RO/EN) for user-facing fields
  • Secure access via RLS; SECURITY DEFINER functions for controlled elevation
  • Optimized indexes for listing discovery and deal workflows
  • Admin tooling for moderation and audits

Quick Snippets ​

Listings (core fields excerpt):

sql
listings (
  id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
  title text NOT NULL,
  price numeric(10,2) NOT NULL,
  category text NOT NULL,
  status public.listing_status DEFAULT 'draft',
  seller_id uuid NOT NULL,
  created_at timestamptz DEFAULT now(),
  updated_at timestamptz DEFAULT now()
)

Profiles (excerpt):

sql
profiles (
  id uuid PRIMARY KEY, -- references auth.users.id
  full_name text,
  role app_role DEFAULT 'buyer',
  subscription_level text DEFAULT 'free',
  subscription_status subscription_status DEFAULT 'inactive',
  language_preference text DEFAULT 'ro',
  created_at timestamptz DEFAULT now()
)
  • Architecture: ../architecture/overview.md
  • Routing and guards: ../architecture/routing.md
  • Blur policy: ../architecture/blur-policy.md

Last updated: 2025-09-15