~singpolyma/jmp-schemas

ref: 2021062 jmp-schemas/deploy/customer_plans.sql -rw-r--r-- 238 bytes
9ff939eeStephen Paul Weber tag for deploy of jmp-pay to production 1 year, 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- Deploy jmp:customer_plans to pg

BEGIN;

CREATE VIEW customer_plans AS
	SELECT DISTINCT ON (customer_id)
		customer_id,
		plan_name,
		expires_at
	FROM plan_log
	WHERE starts_at <= NOW()
	ORDER BY customer_id, starts_at DESC;

COMMIT;