mileage_transactions table
The mileage_transactions table in the Airline Reservation Database Schema schema has 8 columns, keyed by id, with 2 foreign keys to frequent_flyer_accounts and tickets.
Signed append-only ledger. miles_balance is the running total and can always be rebuilt from here.
Columns (8)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| account_id | uuid | not null, references frequent_flyer_accounts.id | |
| ticket_id | uuid | references tickets.id | |
| type | mileage_type | not null | |
| miles | integer | not null | |
| description | varchar(255) | ||
| occurred_at | timestamptz | not null | |
| expires_on | date |
Indexes (1)
(account_id, occurred_at)
Relationships
mileage_transactions.account_idreferencesfrequent_flyer_accounts.idmileage_transactions.ticket_idreferencestickets.id