> For the complete documentation index, see [llms.txt](https://grouple.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://grouple.gitbook.io/docs/supabase/database-schema.md).

# Database Schema

<figure><img src="/files/gzpp1SOXazUGeHEEf0xK" alt=""><figcaption></figcaption></figure>

### Entity Relationship Overview

```
countries → cities → neighbourhoods
                 ↓
merchants (subscription_plans) → venues → venue_amenities (amenities)
                                       → venue_cuisines (cuisines)
                                       → venue_knowledge
                                       → venue_leads ← enquiries ← customers
                                                    ↓
                                                proposals → beos
                                                         → commission_settlements
```

### [​](https://grouple.mintlify.app/supabase/schema#core-tables)Core Tables <a href="#core-tables" id="core-tables"></a>

#### [​](https://grouple.mintlify.app/supabase/schema#customers)`customers` <a href="#customers" id="customers"></a>

Registered end-customers (event planners).

<table><thead><tr><th width="209.8328857421875">Column</th><th width="192.4658203125">Type</th><th>Notes</th></tr></thead><tbody><tr><td>id</td><td>uuid</td><td>Primary key</td></tr><tr><td>supabase_user_id</td><td>uuid</td><td>Links to Supabase Auth</td></tr><tr><td>first_name, last_name</td><td>text</td><td></td></tr><tr><td>email</td><td>text</td><td>NOT NULL</td></tr><tr><td>phone</td><td>text</td><td></td></tr><tr><td>company_name</td><td>text</td><td></td></tr><tr><td>created_at</td><td>timestamp</td><td></td></tr></tbody></table>

#### [​](https://grouple.mintlify.app/supabase/schema#merchants)`merchants` <a href="#merchants" id="merchants"></a>

Venue owners / managers.

<table><thead><tr><th>Column</th><th width="188.700927734375">Type</th><th>Notes</th></tr></thead><tbody><tr><td>id</td><td>uuid</td><td>Primary key</td></tr><tr><td>supabase_user_id</td><td>uuid</td><td>Links to Supabase Auth</td></tr><tr><td>first_name, last_name</td><td>text</td><td></td></tr><tr><td>email</td><td>text</td><td>NOT NULL</td></tr><tr><td>role</td><td>text</td><td></td></tr><tr><td>company_name</td><td>text</td><td></td></tr><tr><td>logo_url</td><td>text</td><td></td></tr><tr><td>onboarding_completed</td><td>boolean</td><td></td></tr><tr><td>plan_id</td><td>text</td><td>FK → subscription_plans</td></tr><tr><td>currency_code</td><td>text</td><td></td></tr></tbody></table>

#### [​](https://grouple.mintlify.app/supabase/schema#venues)`venues` <a href="#venues" id="venues"></a>

Individual venues listed by merchants.

<table><thead><tr><th width="215.20654296875">Column</th><th width="176.7247314453125">Type</th><th>Notes</th></tr></thead><tbody><tr><td>id</td><td>uuid</td><td>Primary key</td></tr><tr><td>merchant_id</td><td>uuid</td><td>FK → merchants</td></tr><tr><td>venue_name</td><td>text</td><td>NOT NULL</td></tr><tr><td>address, city_id, neighbourhood_id</td><td></td><td>Location</td></tr><tr><td>seated_capacity, standing_capacity</td><td>integer</td><td></td></tr><tr><td>price_min, price_max</td><td>numeric</td><td></td></tr><tr><td>operating_hours</td><td>jsonb</td><td></td></tr><tr><td>venue_type_id</td><td>uuid</td><td>FK → venue_types</td></tr><tr><td>currency_code</td><td>text</td><td></td></tr><tr><td>is_active</td><td>boolean</td><td></td></tr><tr><td>public_token</td><td>text</td><td>For public-facing links</td></tr><tr><td>is_featured</td><td>boolean</td><td></td></tr></tbody></table>

#### [​](https://grouple.mintlify.app/supabase/schema#enquiries)`enquiries` <a href="#enquiries" id="enquiries"></a>

Customer group booking requests (RFQs).

<table><thead><tr><th width="225.3741455078125">Column</th><th width="139.44244384765625">Type</th><th>Notes</th></tr></thead><tbody><tr><td>id</td><td>uuid</td><td>Primary key</td></tr><tr><td>rfq_number</td><td>integer</td><td>Auto-incremented sequence</td></tr><tr><td>event_date</td><td>date</td><td>NOT NULL</td></tr><tr><td>time_slot</td><td>time</td><td>NOT NULL</td></tr><tr><td>group_size</td><td>integer</td><td>NOT NULL</td></tr><tr><td>budget_tier</td><td>enum</td><td>Economy / Standard / Premium / Luxury</td></tr><tr><td>city_id, neighbourhood_id</td><td>uuid</td><td></td></tr><tr><td>event_category_id</td><td>uuid</td><td>FK → event_categories</td></tr><tr><td>cuisine_preference_id</td><td>uuid</td><td>FK → cuisines</td></tr><tr><td>venue_type_id</td><td>uuid</td><td>FK → venue_types</td></tr><tr><td>customer_id</td><td>uuid</td><td>FK → customers</td></tr><tr><td>currency_code</td><td>text</td><td>Auto-synced from city</td></tr><tr><td>status</td><td>text</td><td>open / confirmed</td></tr><tr><td>confirmed_proposal_id</td><td>uuid</td><td>Set on confirmation</td></tr><tr><td>confirmed_venue_id</td><td>uuid</td><td>Set on confirmation</td></tr></tbody></table>

#### [​](https://grouple.mintlify.app/supabase/schema#venue_leads)`venue_leads` <a href="#venue_leads" id="venue_leads"></a>

Junction between an enquiry and a specific venue — one lead per venue per enquiry.

<table><thead><tr><th width="237.53558349609375">Column</th><th width="146.21044921875">Type</th><th>Notes</th></tr></thead><tbody><tr><td>id</td><td>uuid</td><td>Primary key</td></tr><tr><td>enquiry_id</td><td>uuid</td><td>FK → enquiries</td></tr><tr><td>venue_id</td><td>uuid</td><td>FK → venues</td></tr><tr><td>merchant_id</td><td>uuid</td><td>FK → merchants</td></tr><tr><td>status</td><td>enum</td><td>pending / accepted / declined / connected / closed_won / closed_lost</td></tr><tr><td>merchant_rfq_number</td><td>integer</td><td>Auto-set by trigger</td></tr><tr><td>proposed_event_date</td><td>date</td><td>Merchant can counter-propose</td></tr><tr><td>proposed_group_size</td><td>integer</td><td></td></tr><tr><td>is_counter_offer</td><td>boolean</td><td></td></tr><tr><td>accepted_at, declined_at, closed_won_at, closed_lost_at</td><td>timestamp</td><td></td></tr><tr><td>is_read</td><td>boolean</td><td></td></tr></tbody></table>

#### [​](https://grouple.mintlify.app/supabase/schema#proposals)`proposals` <a href="#proposals" id="proposals"></a>

Proposals sent by merchants in response to leads.

<table><thead><tr><th width="207.91497802734375">Column</th><th width="141.34075927734375">Type</th><th>Notes</th></tr></thead><tbody><tr><td>id</td><td>uuid</td><td>Primary key</td></tr><tr><td>venue_lead_id</td><td>uuid</td><td>FK → venue_leads</td></tr><tr><td>venue_id</td><td>uuid</td><td>FK → venues</td></tr><tr><td>title</td><td>text</td><td></td></tr><tr><td>status</td><td>enum</td><td>draft / sent / viewed / confirmed / declined / expired</td></tr><tr><td>offer_valid_until</td><td>date</td><td></td></tr><tr><td>details</td><td>text</td><td>AI-generated or manual</td></tr><tr><td>package_inclusions</td><td>text[]</td><td></td></tr><tr><td>amount, service_fee, discount, total</td><td>numeric</td><td></td></tr><tr><td>price_type</td><td>enum</td><td>Per Person / Per Bottle / Per Item / Per Event</td></tr><tr><td>payment_terms, venue_policies</td><td>text</td><td></td></tr><tr><td>ai_generated</td><td>boolean</td><td></td></tr><tr><td>public_token</td><td>text</td><td>For public-facing proposal links</td></tr><tr><td>signed_by_name, signed_at, signature_base64</td><td></td><td>Digital signature</td></tr><tr><td>selected_packages</td><td>jsonb</td><td></td></tr><tr><td>currency_code</td><td>text</td><td></td></tr></tbody></table>

#### [​](https://grouple.mintlify.app/supabase/schema#commission_settlements)`commission_settlements` <a href="#commission_settlements" id="commission_settlements"></a>

Auto-created when a proposal is confirmed.

<table><thead><tr><th width="241.84588623046875">Column</th><th width="147.6290283203125">Type</th><th>Notes</th></tr></thead><tbody><tr><td>proposal_id</td><td>uuid</td><td>FK → proposals</td></tr><tr><td>merchant_id</td><td>uuid</td><td>FK → merchants</td></tr><tr><td>applied_commission_rate</td><td>numeric</td><td>From subscription plan</td></tr><tr><td>status</td><td>enum</td><td>unpaid / pending_verification / paid / cancelled</td></tr><tr><td>is_paid</td><td>boolean</td><td></td></tr><tr><td>receipt_url, invoice_url</td><td>text</td><td></td></tr></tbody></table>

#### [​](https://grouple.mintlify.app/supabase/schema#beos)`beos` <a href="#beos" id="beos"></a>

Banquet Event Orders linked to confirmed proposals.

<table><thead><tr><th width="214.880126953125">Column</th><th width="149.40496826171875">Type</th><th>Notes</th></tr></thead><tbody><tr><td>proposal_id</td><td>uuid</td><td>FK → proposals</td></tr><tr><td>setup_time</td><td>text</td><td></td></tr><tr><td>table_setup</td><td>text</td><td></td></tr><tr><td>staffing_requirements</td><td>text</td><td></td></tr><tr><td>av_requirements</td><td>text</td><td></td></tr><tr><td>sales_contact, venue_mobile</td><td>text</td><td></td></tr><tr><td>miscellaneous_notes</td><td>text</td><td></td></tr></tbody></table>

#### [​](https://grouple.mintlify.app/supabase/schema#venue_knowledge)`venue_knowledge` <a href="#venue_knowledge" id="venue_knowledge"></a>

PDF menus and brochures uploaded by merchants for AI extraction.

<table><thead><tr><th width="181.4549560546875">Column</th><th width="142.23443603515625">Type</th><th>Notes</th></tr></thead><tbody><tr><td>venue_id</td><td>uuid</td><td>FK → venues</td></tr><tr><td>merchant_id</td><td>uuid</td><td>FK → merchants</td></tr><tr><td>file_path</td><td>text</td><td>NOT NULL — path in Supabase Storage</td></tr><tr><td>extracted_data</td><td>jsonb</td><td>AI-extracted content</td></tr><tr><td>status</td><td>text</td><td></td></tr></tbody></table>

#### [​](https://grouple.mintlify.app/supabase/schema#support-tables)Support Tables <a href="#support-tables" id="support-tables"></a>

<table><thead><tr><th width="281.8798828125">Table</th><th>Purpose</th></tr></thead><tbody><tr><td><code>cities</code></td><td>City list with default currency</td></tr><tr><td><code>countries</code></td><td>Country reference data</td></tr><tr><td><code>neighbourhoods</code></td><td>Neighbourhood lookup (FK → cities)</td></tr><tr><td><code>amenities</code></td><td>Amenity types (e.g. “Private Room”, “AV Equipment”)</td></tr><tr><td><code>cuisines</code></td><td>Cuisine types</td></tr><tr><td><code>event_categories</code></td><td>Event types</td></tr><tr><td><code>venue_types</code></td><td>Venue type categories</td></tr><tr><td><code>subscription_plans</code></td><td>Merchant plan definitions</td></tr><tr><td><code>exchange_rates</code></td><td>Currency exchange rates (updated by Edge Function)</td></tr><tr><td><code>lead_response_times</code></td><td>Tracks how quickly merchants respond to leads</td></tr><tr><td><code>lead_values</code></td><td>Estimated booking value per lead</td></tr><tr><td><code>merchant_lead_counter</code></td><td>Tracks last RFQ number per merchant</td></tr><tr><td><code>merchant_analytics_v3</code></td><td>Materialised view for analytics dashboard</td></tr><tr><td><code>merchant_commission_ledger</code></td><td>View for commission tracking</td></tr></tbody></table>

### [​](https://grouple.mintlify.app/supabase/schema#enums)Enums <a href="#enums" id="enums"></a>

<table><thead><tr><th width="204.021484375">Enum</th><th>Values</th></tr></thead><tbody><tr><td><code>budget_tier</code></td><td>Economy, Standard, Premium, Luxury</td></tr><tr><td><code>lead_status</code></td><td>pending, accepted, declined, connected, closed_won, closed_lost</td></tr><tr><td><code>proposal_status</code></td><td>draft, sent, viewed, confirmed, declined, expired</td></tr><tr><td><code>commission_status</code></td><td>unpaid, pending_verification, paid, cancelled</td></tr><tr><td><code>price_type</code></td><td>Per Person, Per Bottle, Per Item, Per Event</td></tr><tr><td><code>currency_code_type</code></td><td>USD, AED, GBP, INR, EUR</td></tr><tr><td><code>occasion_type</code></td><td>Corporate, Birthday Party, Conferences/Seminars, Gala Dinners, and 13 more</td></tr></tbody></table>

[<br>](https://grouple.mintlify.app/supabase/overview)
