~singpolyma/jmp-schemas

9b7bc1fb7fb41a9025ba57d536bc6c64984ff23b — Stephen Paul Weber 1 year, 4 months ago 90c65e0
Table to log plans active on different accounts
4 files changed, 34 insertions(+), 0 deletions(-)

A deploy/plan_log.sql
A revert/plan_log.sql
M sqitch.plan
A verify/plan_log.sql
A deploy/plan_log.sql => deploy/plan_log.sql +14 -0
@@ 0,0 1,14 @@
-- Deploy jmp:plan_log to pg

BEGIN;

CREATE TABLE plan_log (
	customer_id TEXT      NOT NULL,
	plan_name   TEXT      NOT NULL,
	starts_at   TIMESTAMP NOT NULL,
	expires_at  TIMESTAMP NOT NULL
);

CREATE INDEX ON plan_log (customer_id, starts_at DESC);

COMMIT;

A revert/plan_log.sql => revert/plan_log.sql +7 -0
@@ 0,0 1,7 @@
-- Revert jmp:plan_log from pg

BEGIN;

DROP TABLE plan_log;

COMMIT;

M sqitch.plan => sqitch.plan +1 -0
@@ 4,3 4,4 @@
transactions 2021-02-22T19:15:25Z Stephen Paul Weber <singpolyma@singpolyma.net> # Creates a table to track user's transactions
balances 2021-02-23T15:08:09Z Stephen Paul Weber <singpolyma@singpolyma.net> # Creates a view to lookup customer balances
sub_cent_transactions 2021-02-24T01:37:35Z Stephen Paul Weber <singpolyma@singpolyma.net> # Minutes cost less than 1 cent, so we need more decimal places
plan_log 2021-02-24T01:53:29Z Stephen Paul Weber <singpolyma@singpolyma.net> # Log to show what plans an account has had

A verify/plan_log.sql => verify/plan_log.sql +12 -0
@@ 0,0 1,12 @@
-- Verify jmp:plan_log on pg

BEGIN;

SELECT
	customer_id,
	plan_name,
	starts_at,
	expires_at
FROM plan_log;

ROLLBACK;