~singpolyma/jmp-schemas

8cafb6f6d06dc12847f064c2964617bc1cfec16d — Stephen Paul Weber 2 years ago 12f3a33
Give plan_log a primary key

Can't have two entries starting at the same time
1 files changed, 2 insertions(+), 3 deletions(-)

M deploy/plan_log.sql
M deploy/plan_log.sql => deploy/plan_log.sql +2 -3
@@ 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;