From 8cafb6f6d06dc12847f064c2964617bc1cfec16d Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Sun, 28 Feb 2021 22:03:42 -0500 Subject: [PATCH] Give plan_log a primary key Can't have two entries starting at the same time --- deploy/plan_log.sql | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/deploy/plan_log.sql b/deploy/plan_log.sql index 790fb86..f878e2d 100644 --- a/deploy/plan_log.sql +++ b/deploy/plan_log.sql @@ -6,9 +6,8 @@ CREATE TABLE plan_log ( customer_id TEXT NOT NULL, plan_name TEXT NOT NULL, starts_at TIMESTAMP NOT NULL, - expires_at TIMESTAMP NOT NULL + expires_at TIMESTAMP NOT NULL, + PRIMARY KEY (customer_id, starts_at) ); -CREATE INDEX ON plan_log (customer_id, starts_at DESC); - COMMIT; -- 2.45.2