From 9b7bc1fb7fb41a9025ba57d536bc6c64984ff23b Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 23 Feb 2021 21:05:43 -0500 Subject: [PATCH] Table to log plans active on different accounts --- deploy/plan_log.sql | 14 ++++++++++++++ revert/plan_log.sql | 7 +++++++ sqitch.plan | 1 + verify/plan_log.sql | 12 ++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 deploy/plan_log.sql create mode 100644 revert/plan_log.sql create mode 100644 verify/plan_log.sql diff --git a/deploy/plan_log.sql b/deploy/plan_log.sql new file mode 100644 index 0000000..790fb86 --- /dev/null +++ b/deploy/plan_log.sql @@ -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; diff --git a/revert/plan_log.sql b/revert/plan_log.sql new file mode 100644 index 0000000..7b3ce11 --- /dev/null +++ b/revert/plan_log.sql @@ -0,0 +1,7 @@ +-- Revert jmp:plan_log from pg + +BEGIN; + +DROP TABLE plan_log; + +COMMIT; diff --git a/sqitch.plan b/sqitch.plan index 2afa1b7..24a68e7 100644 --- a/sqitch.plan +++ b/sqitch.plan @@ -4,3 +4,4 @@ transactions 2021-02-22T19:15:25Z Stephen Paul Weber # Creates a table to track user's transactions balances 2021-02-23T15:08:09Z Stephen Paul Weber # Creates a view to lookup customer balances sub_cent_transactions 2021-02-24T01:37:35Z Stephen Paul Weber # Minutes cost less than 1 cent, so we need more decimal places +plan_log 2021-02-24T01:53:29Z Stephen Paul Weber # Log to show what plans an account has had diff --git a/verify/plan_log.sql b/verify/plan_log.sql new file mode 100644 index 0000000..c0895ca --- /dev/null +++ b/verify/plan_log.sql @@ -0,0 +1,12 @@ +-- Verify jmp:plan_log on pg + +BEGIN; + +SELECT + customer_id, + plan_name, + starts_at, + expires_at +FROM plan_log; + +ROLLBACK; -- 2.45.2