trip_user

31 rows


Description

Holds all trip users (driver, assistants and passengers)

Columns

Column Type Size Nulls Auto Default Children Parents Comments
id bigserial 19 nextval('trip_user_id_seq'::regclass)

Unique ID

id_tenant int4 10 1
tenant.id fk_trip_user_id_tenant R

Reference to the tenant

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_user_id_creator R

Reference to the creator

id_updater int4 10 null
user.id fk_trip_user_id_updater R

Reference to the last updater

id_trip int8 19 null
trip.id fk_trip_user_id_trip R

Reference to the trip

id_user int4 10 null
user.id fk_trip_user_id_user R

Reference to the user (driver/assistant/passenger)

id_tripusertype int2 5 null
tripusertype.id fk_trip_user_id_tripusertype R

Reference to the trip user type (driver/assistant/passenger)

started_at timestamp 29,6 now()

Timestamp when the user started in the trip

stopped_at timestamp 29,6 null

Timestamp when the user stopped/exited this trip

km_start int4 10 null

The mileage km at the moment the id_user assigned himself to the trip

km_stop int4 10 null

The mileage km at the moment the id_user removes himself from the trip

latitude_start float8 17,17 null

The latitude of the start of this trip user

longitude_start float8 17,17 null

The longitude of the start of this trip user

latitude_stop float8 17,17 null

The latitude of the stop of this trip user

longitude_stop float8 17,17 null

The longitude of the stop of this trip user

note text 2147483647 null

A note for this trip

Indexes

Constraint Name Type Sort Column(s)
pk_trip_user_id Primary key Asc id
u_trip_user_id_trip_id_user Must be unique Asc/Asc id_trip + id_user

Check Constraints

Constraint Name Constraint
c_trip_user_stopkm_after_startkm ((km_start <= km_stop))
c_trip_user_stop_after_start ((started_at < stopped_at))

Relationships