Table layout added by sjamaan on Wed Sep 23 15:04:02 2020

Before:

                                          Table "public.activity_tachoevent"
      Column       |           Type           | Collation | Nullable |                     Default                     
-------------------+--------------------------+-----------+----------+-------------------------------------------------
 id                | integer                  |           | not null | nextval('activity_tachoevent_id_seq'::regclass)
 data_external_id  | bigint                   |           | not null | 
 measured_at       | timestamp with time zone |           | not null | 
 msg_seq           | integer                  |           | not null | 
 odometer          | integer                  |           |          | 
 action            | text                     |           | not null | 
 driver_id         | integer                  |           | not null | 
 truck_id          | integer                  |           |          | 
 truck_position_id | integer                  |           |          | 
 point             | geography(Point,4326)    |           |          | 
 data_source       | text                     |           |          | 
Indexes:
    "activity_tachoevent_pkey" PRIMARY KEY, btree (id)
    "activity_tachoevent_data_source_data_external_id_b5518bea_uniq" UNIQUE CONSTRAINT, btree (data_source, data_external_id)
    "one_current_event_per_driver" UNIQUE, btree (driver_id) WHERE data_external_id < 0
    "activity_ta_driver__9ea5ad_idx" btree (driver_id, measured_at DESC, data_external_id DESC)
    "activity_ta_truck_i_71f0f5_idx" btree (truck_id, measured_at DESC, data_external_id DESC)
    "activity_tachoevent_driver_id_669ea416" btree (driver_id)
    "activity_tachoevent_truck_id_1bc49fb1" btree (truck_id)
    "activity_tachoevent_truck_position_id_d97e1b29" btree (truck_position_id)
Check constraints:
    "activity_tachoevent_msg_seq_check" CHECK (msg_seq >= 0)
    "activity_tachoevent_odometer_check" CHECK (odometer >= 0)
Foreign-key constraints:
    "activity_tachoevent_driver_id_669ea416_fk_asset_driver_id" FOREIGN KEY (driver_id) REFERENCES asset_driver(id) DEFERRABLE INITIALLY DEFERRED
    "activity_tachoevent_truck_id_1bc49fb1_fk_asset_truck_id" FOREIGN KEY (truck_id) REFERENCES asset_truck(id) DEFERRABLE INITIALLY DEFERRED
    "activity_tachoevent_truck_position_id_d97e1b29_fk_activity_" FOREIGN KEY (truck_position_id) REFERENCES activity_truckposition(id) DEFERRABLE INITIALLY DEFERRED

=-=-=-=-=-=-=-=-=-=-=-=

After ALTER TABLE activity_tachoevent DROP COLUMN msg_seq:

                                          Table "public.activity_tachoevent"
      Column       |           Type           | Collation | Nullable |                     Default                     
-------------------+--------------------------+-----------+----------+-------------------------------------------------
 id                | integer                  |           | not null | nextval('activity_tachoevent_id_seq'::regclass)
 data_external_id  | bigint                   |           | not null | 
 measured_at       | timestamp with time zone |           | not null | 
 odometer          | integer                  |           |          | 
 action            | text                     |           | not null | 
 driver_id         | integer                  |           | not null | 
 truck_id          | integer                  |           |          | 
 truck_position_id | integer                  |           |          | 
 point             | geography(Point,4326)    |           |          | 
 data_source       | text                     |           |          | 
Indexes:
    "activity_tachoevent_pkey" PRIMARY KEY, btree (id)
    "activity_tachoevent_data_source_data_external_id_b5518bea_uniq" UNIQUE CONSTRAINT, btree (data_source, data_external_id)
    "one_current_event_per_driver" UNIQUE, btree (driver_id) WHERE data_external_id < 0
    "activity_ta_driver__9ea5ad_idx" btree (driver_id, measured_at DESC, data_external_id DESC)
    "activity_ta_truck_i_71f0f5_idx" btree (truck_id, measured_at DESC, data_external_id DESC)
    "activity_tachoevent_driver_id_669ea416" btree (driver_id)
    "activity_tachoevent_truck_id_1bc49fb1" btree (truck_id)
    "activity_tachoevent_truck_position_id_d97e1b29" btree (truck_position_id)
Check constraints:
    "activity_tachoevent_odometer_check" CHECK (odometer >= 0)
Foreign-key constraints:
    "activity_tachoevent_driver_id_669ea416_fk_asset_driver_id" FOREIGN KEY (driver_id) REFERENCES asset_driver(id) DEFERRABLE INITIALLY DEFERRED
    "activity_tachoevent_truck_id_1bc49fb1_fk_asset_truck_id" FOREIGN KEY (truck_id) REFERENCES asset_truck(id) DEFERRABLE INITIALLY DEFERRED
    "activity_tachoevent_truck_position_id_d97e1b29_fk_activity_" FOREIGN KEY (truck_position_id) REFERENCES activity_truckposition(id) DEFERRABLE INITIALLY DEFERRED