Skip to content

Commit

Permalink
add unique constraint for vehicles
Browse files Browse the repository at this point in the history
  • Loading branch information
thekaveman committed May 21, 2020
1 parent d7b908a commit 891a744
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion db/migrations/mds-0.4.x.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ CREATE TABLE vehicles (
battery_pct double precision null,
last_updated timestamptz not null,
ttl integer not null,
sequence_id bigserial not null
sequence_id bigserial not null,
CONSTRAINT unique_vehicle_event UNIQUE (provider_id, device_id, last_updated)
);


Expand Down
3 changes: 2 additions & 1 deletion db/setup/vehicles.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ CREATE TABLE vehicles (
battery_pct double precision null,
last_updated timestamptz not null,
ttl integer not null,
sequence_id bigserial not null
sequence_id bigserial not null,
CONSTRAINT unique_vehicle_event UNIQUE (provider_id, device_id, last_updated)
);

0 comments on commit 891a744

Please sign in to comment.