carpool-service/storage/postgresql/schema.hcl

105 lines
1.8 KiB
HCL
Raw Normal View History

table "bookings" {
schema = schema.carpool_service
column "id" {
null = false
type = uuid
}
column "booking" {
null = false
type = jsonb
}
column "status" {
null = false
type = enum.booking_status
}
column "driver_route" {
null = true
type = jsonb
}
column "passenger_route" {
null = true
type = jsonb
}
primary_key {
columns = [column.id]
}
}
table "journeys_cache" {
schema = schema.carpool_service
column "id" {
null = false
type = uuid
}
column "data" {
null = false
type = jsonb
}
column "created_at" {
null = false
type = timestamptz
default = sql("now()")
}
primary_key {
columns = [column.id]
}
}
table "regular_route_schedules" {
schema = schema.carpool_service
column "route_id" {
null = false
type = uuid
}
column "day" {
null = false
type = enum.day
}
column "time_of_day" {
null = false
type = time
}
}
table "regular_routes" {
schema = schema.carpool_service
column "id" {
null = false
type = uuid
}
column "user_id" {
null = false
type = uuid
}
column "routes_group_id" {
null = true
type = uuid
}
column "grid_ids" {
null = true
type = sql("numeric[]")
}
column "is_driver" {
null = true
type = boolean
}
column "is_passenger" {
null = true
type = boolean
}
column "route" {
null = false
type = jsonb
}
primary_key {
columns = [column.id]
}
}
enum "booking_status" {
schema = schema.carpool_service
values = ["INITIATED", "WAITING_PASSENGER_CONFIRMATION", "WAITING_DRIVER_CONFIRMATION", "CONFIRMED", "CANCELLED", "COMPLETED_PENDING_VALIDATION", "VALIDATED"]
}
enum "day" {
schema = schema.carpool_service
values = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"]
}
schema "carpool_service" {
}