Gate2hotels
BAGHDAD (UTC+3)
Ali Al-Husseini
SCHEMA::POSTGRESQL_SPEC[MIGRATION_SET: 00001_00002]

38 Core Database Tables Specification

PostgreSQL relational database schema implemented with UUID primary keys, public human-readable identifiers, Row Level Security, and high-performance indexes.

MIGRATED_TABLES
38 / 38
ROW_LEVEL_SECURITY
ACTIVE
ID_FORMAT
UUIDv4 + G2H-*
TARGET_ENGINE
Supabase PostgreSQL

Schema Catalog (39 of 38 tables)

Every table includes UUID primary keys, human-readable public IDs, indexes, and RLS

#Table NameCategoryFunctional DescriptionRLSSeeded Records
1
users
CorePlatform accounts across all 6 roles with public IDs and credentialsEnabled6 rows
2
organizations
CoreB2B entities: Hotel chains, single properties, OTA partnersEnabled4 rows
3
organization_users
CoreCross-tenant organization membership and org rolesEnabled6 rows
4
hotels
HotelIraqi properties across Baghdad, Erbil, Karbala, Basra, etc.Enabled5 rows
5
hotel_users
HotelSpecific hotel staff assignments and permissionsEnabled3 rows
6
hotel_contacts
HotelEmergency, billing, GM, and reservation department contactsEnabled5 rows
7
hotel_addresses
HotelIraqi governorate addresses, GPS coordinates, landmarksEnabled5 rows
8
hotel_photos
HotelHigh-res exterior, lobby, room, and dining photographyEnabled12 rows
9
hotel_facilities
HotelAmenities (24/7 generator, prayer room, Tigris view, etc.)Enabled18 rows
10
hotel_documents
HotelTourism ministry licenses, commercial registers, tax IDsEnabled5 rows
11
hotel_verification
HotelVerification audit trail and verification status trackingEnabled5 rows
12
room_types
Inventory & RatesRoom categories (King, Twin, Executive Suites) & sizesEnabled3 rows
13
rooms
Inventory & RatesPhysical numbered inventory and housekeeping statusEnabled24 rows
14
rate_plans
Inventory & RatesPricing strategies: BAR Room Only, Bed & BreakfastEnabled2 rows
15
rate_plan_rules
Inventory & RatesMin/max stay length, cut-off days, advance purchase rulesEnabled2 rows
16
rates
Inventory & RatesDaily calendar single, double, and extra-bed pricingEnabled60 rows
17
availability
Inventory & RatesDaily room inventory: Total, booked, blocked, availableEnabled60 rows
18
restrictions
Inventory & RatesStop-sells, Closed-to-Arrival, Closed-to-DepartureEnabled10 rows
19
inventory_adjustments
Inventory & RatesAudit trail of manual room adjustments and blockagesEnabled4 rows
20
cancellation_policies
Inventory & Rates24h free cancellation, non-refundable penalty schemesEnabled2 rows
21
meal_plans
Inventory & RatesMeal options: RO, BB, HB, FB, AI catering codesEnabled2 rows
22
reservations
ReservationsCentral reservation records, guest vouchers, financial totalsEnabled3 rows
23
reservation_rooms
ReservationsBooked room type lines, daily rates, occupant countsEnabled3 rows
24
reservation_guests
ReservationsGuest manifest: Names, civil IDs, passports, nationalitiesEnabled3 rows
25
reservation_status_history
ReservationsState machine transition logs with user stampsEnabled6 rows
26
reservation_modifications
ReservationsChange logs with prior and updated JSON payloadsEnabled2 rows
27
reservation_cancellations
ReservationsCancellation records, reasons, applied penalty feesEnabled0 rows
28
api_clients
API DistributionAuthorized B2B wholesalers, OTAs, and metasearch partnersEnabled2 rows
29
api_client_users
API DistributionPartner technical admins and developer accountsEnabled2 rows
30
api_keys
API DistributionSHA-256 hashed API secrets with live/test key prefixesEnabled2 rows
31
api_permissions
API DistributionGranular scopes (HOTELS_READ, BOOKINGS_CREATE, etc.)Enabled6 rows
32
api_client_hotels
API DistributionProperty-partner linkage contracts and commission ratesEnabled2 rows
33
api_logs
API DistributionB2B API traffic telemetry, latency, status codesEnabled142 rows
34
api_errors
API DistributionAPI exception reports, error codes, partner diagnosticsEnabled4 rows
35
webhooks
API DistributionRegistered webhook subscriber endpoints & signing secretsEnabled2 rows
36
webhook_deliveries
API DistributionDelivery payloads, retry counters, HTTP response codesEnabled18 rows
37
audit_logs
Audit & SystemComprehensive enterprise mutation ledger with IP/user auditEnabled38 rows
38
notifications
Audit & SystemTargeted user notifications for bookings and approvalsEnabled8 rows
39
system_settings
Audit & SystemSystem-wide configurations, currencies, and exchange ratesPublic2 rows