~singpolyma/jmp-schemas

ref: 8e704d587f92885c87b2e45675f8bdfce0fb3d7a jmp-schemas/sqitch.plan -rw-r--r-- 4.5 KiB
8e704d58Stephen Paul Weber Maybe renew a customer when they top up 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
%syntax-version=1.0.0
%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
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
customer_plans 2021-02-24T02:06:25Z Stephen Paul Weber <singpolyma@singpolyma.net> # View of current customer plans
cdr 2021-02-24T18:36:49Z Stephen Paul Weber <singpolyma@singpolyma.net> # Create CDR table for Asterisk
@2021062 2021-03-03T14:38:01Z Stephen Paul Weber <singpolyma@singpolyma.net> # First production deploy of jmp-pay

plan_log_with_range [plan_log customer_plans] 2021-05-03T19:30:36Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Switch plan_log to use a tsrange
@2021130 2021-05-11T01:37:34Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Deploy to production

invites 2021-05-17T20:31:00Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Table to store invite codes and their state
unused_invites 2021-05-17T20:40:20Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # View for invites not yet used
invite_per_15 [transactions invites] 2021-08-18T17:46:38Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # $15 gives you an invite code
call_rates 2021-11-17T01:29:07Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Table to store per-plan per-direction rates to different prefixes
cdr_with_charge [cdr call_rates customer_plans] 2021-11-17T01:44:14Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # View to get CDR records augmented with rate and charge amount
plans 2021-11-17T18:06:30Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Table for plan metadata\n\nIdeally this would come from a dhall_fdw, but for now we can import to this.
customers 2021-11-30T16:36:48Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Get customers from Redis\n\nRequires a redis_server to be configured on the postgres instance.
cdr_charge [customer_plans plans cdr_with_charge] 2021-11-17T18:09:49Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Get the amount to charge a customer for a given CDR
insert_charge_for_cdr [cdr_charge cdr_with_charge transactions] 2021-11-23T14:41:15Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Trigger to insert a transaction for the charge for this CDR
notify_low_balance [transactions balances] 2021-12-22T00:36:03Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # NOTIFY when balance dips low
@2022039 2022-02-08T15:35:37Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Call limits and billing rollout

cdr_with_charge_faster [cdr_with_charge] 2022-02-08T17:12:16Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Allow Postgres to push down WHERE over customer_id
@2022039.1 2022-02-08T17:16:11Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Fix for cdr_with_charge performance

cdr_with_charge_rate_when_no_plan [cdr_with_charge_faster] 2022-02-09T01:55:13Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Get a default rate when customer has no plan
@2022040 2022-02-09T16:08:26Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Default rate for customers with no plan

invites_rewarded_at [invites] 2022-02-22T16:54:33Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Add rewarded_at to invites so we can track rewards\n\nNeed this because we don't reward right at use, but later after they have paid.
@2022075 2022-03-16T14:08:42Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # invites.rewarded_at

settled_after [transactions] 2022-04-11T17:34:18Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Consider transactions settled after some time
@2022102 2022-04-12T17:47:32Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Add settled_after to transactions

require_settled_after [settled_after insert_charge_for_cdr] 2022-04-12T18:45:50Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Make sure settled_after is NOT NULL
@2022103 2022-04-13T15:05:58Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # Tag settled_after NOT NULL

notify_possible_renewal_on_expired_top_up [transactions customer_plans] 2022-04-19T17:53:50Z Stephen Paul Weber,,, <singpolyma@singpolyma-beefy> # When an expired customer tops up, notify to try renewal