trip

21 rows


Description

Holds all trips

Columns

Column Type Size Nulls Auto Default Children Parents Comments
id bigserial 19 nextval('trip_id_seq'::regclass)
accounting.id_trip fk_accounting_id_trip R
trip_user.id_trip fk_trip_user_id_trip R

Unique ID

created_at timestamp 29,6 now()

Timestamp of creation

updated_at timestamp 29,6 now()

Timestamp of last update

id_creator int4 10 null
user.id fk_trip_id_creator R

Reference to the creator

id_updater int4 10 null
user.id fk_trip_id_updater R

Reference to the last updater

id_car int4 10 null
car.id fk_trip_id_car R

Reference to the car

started_at timestamp 29,6 now()

Timestamp when the trip started

stopped_at timestamp 29,6 null

Timestamp when the trip stopped

km_start int4 10 null

The mileage km at the start of the trip

km_stop int4 10 null

The mileage km at the end of the trip

note text 2147483647 null

A note for this trip

latitude_start float8 17,17 null

The latitude of the start of this trip

longitude_start float8 17,17 null

The longitude of the start of this trip

latitude_stop float8 17,17 null

The latitude of the stop of this trip

longitude_stop float8 17,17 null

The longitude of the stop of this trip

id_tenant int4 10 null
tenant.id fk_trip_id_tenant R

Reference to the tenant

Indexes

Constraint Name Type Sort Column(s)
pk_trip_id Primary key Asc id
idx_trip_date_started_at Performance
uidx_trip_id_car_stopped_at_null Must be unique Asc id_car

Check Constraints

Constraint Name Constraint
c_trip_stop_after_start ((started_at < stopped_at))
c_trip_stopkm_after_startkm ((km_start <= km_stop))

Relationships