Overview
The SkyTeam ROBLOX database uses PostgreSQL with Drizzle ORM. The schema is defined inpackages/database/src/schema.ts.
Tables
users
Stores ROBLOX user information and miles balance.Primary key. ROBLOX user ID.
ROBLOX username (unique).
User’s display name.
Current miles balance.
URL to user’s avatar image.
When the user record was created.
When the user record was last updated.
airlines
Stores airline information and API tokens.Primary key. Unique airline identifier.
Airline name.
API authentication token (unique). Generated using CUID2.
Discord invite link for the airline.
Discord server ID.
When the airline was created.
When the airline was last updated.
brands
Stores airline brands (sub-brands or operating brands).Primary key. Unique brand identifier.
Foreign key to airlines.airlineId.
Brand name.
IATA airline code (2 characters, unique).
ICAO airline code (3 characters, unique).
Radio callsign (unique).
Whether this is the airline’s primary brand.
URL to brand logo image.
Brand accent color (hex).
Brand secondary color (hex).
Brand element color (hex).
flights
Stores scheduled and completed flights.Primary key. Auto-generated UUID.
Flight code (e.g., “ST123”).
ROBLOX game/place ID.
Aircraft type.
Foreign key to airlines.airlineId.
Foreign key to brands.brandId.
Scheduled start time.
When the flight ended (null for active/upcoming flights).
Foreign key to airlines.airlineId for codeshare partner.
Departure airport code.
Arrival airport code.
When the flight actually started (null until started).
Discord event link for the flight.
flightPassengers
Links users to flights and tracks miles earned per flight.Foreign key to flights.id.
Foreign key to users.userId.
Miles earned from this flight.
When the user joined the flight.
This table has a composite key of (flightId, userId).
milesTransactions
Logs all miles earnings and spending for audit trail.Primary key. Auto-generated UUID.
Foreign key to users.userId.
Miles amount (positive for earn, negative for spend).
Transaction type: ‘earn’ or ‘spend’.
Source of transaction: ‘flight’, ‘purchase’, or custom string.
Foreign key to flights.id (if transaction related to a flight).
Product ID (if transaction was a purchase).
Optional note describing the transaction.
When the transaction occurred.
milesProducts
Stores purchasable products that airlines can offer.Primary key. 6-character alphanumeric ID.
Foreign key to airlines.airlineId.
Product name.
Product description.
Cost in miles.
Whether product is available for purchase.
When the product was created.
Relationships
Airlines → Brands
- One-to-many: An airline can have multiple brands
- Foreign key:
brands.airlineId→airlines.airlineId
Airlines → Flights
- One-to-many: An airline can operate multiple flights
- Foreign key:
flights.airlineId→airlines.airlineId
Brands → Flights
- One-to-many: A brand can operate multiple flights
- Foreign key:
flights.brandId→brands.brandId
Flights → FlightPassengers → Users
- Many-to-many through
flightPassengers - A flight can have many passengers
- A user can be on many flights
Users → MilesTransactions
- One-to-many: A user can have multiple transactions
- Foreign key:
milesTransactions.userId→users.userId
Airlines → MilesProducts
- One-to-many: An airline can offer multiple products
- Foreign key:
milesProducts.airlineId→airlines.airlineId
Schema Definition
Location:packages/database/src/schema.ts