~singpolyma/jmp-schemas

a47fa1303f59c57055d979083752f5ac65458078 — Stephen Paul Weber 1 year, 2 months ago bd52ab0
Create balances view
4 files changed, 30 insertions(+), 0 deletions(-)

A deploy/balances.sql
A revert/balances.sql
M sqitch.plan
A verify/balances.sql
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;