A deploy/balances.sql => deploy/balances.sql +12 -0
@@ 0,0 1,12 @@
+-- Deploy jmp:balances to pg
+
+BEGIN;
+
+CREATE VIEW balances AS
+ SELECT
+ customer_id,
+ SUM(amount) AS balance
+ FROM transactions
+ GROUP BY customer_id;
+
+COMMIT;
A revert/balances.sql => revert/balances.sql +7 -0
@@ 0,0 1,7 @@
+-- Revert jmp:balances from pg
+
+BEGIN;
+
+DROP VIEW balances;
+
+COMMIT;
M sqitch.plan => sqitch.plan +1 -0
@@ 2,3 2,4 @@
%project=jmp
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
A verify/balances.sql => verify/balances.sql +10 -0
@@ 0,0 1,10 @@
+-- Verify jmp:balances on pg
+
+BEGIN;
+
+SELECT
+ customer_id,
+ balance
+FROM balances;
+
+ROLLBACK;