-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates to the stripe invoice generator:
* For tenants that do not have a credit card: * Skip generating invoices for tenants that have no data flowing in the billed month * Skip generating invoices for tenants that didn't have both an active capture _and_ an active materialization in the billed month * Add stub stripe customers table to allow sqlx to properly infer query shapes * Automatically remove existing draft invoices if a new rule has been introduced that would have skipped that invoice
- Loading branch information
Showing
2 changed files
with
181 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
begin; | ||
|
||
create schema stripe; | ||
grant usage on schema stripe to postgres; | ||
|
||
-- Included here to match the shape of production database so that sqlx can infer queries properly. | ||
create table stripe.customers ( | ||
id text PRIMARY KEY, | ||
address json, | ||
"address/city" text, | ||
"address/country" text, | ||
"address/line1" text, | ||
"address/line2" text, | ||
"address/postal_code" text, | ||
"address/state" text, | ||
balance bigint, | ||
created bigint, | ||
currency text, | ||
default_source text, | ||
delinquent boolean, | ||
description text, | ||
email text, | ||
invoice_prefix text, | ||
invoice_settings json, | ||
"invoice_settings/custom_fields" json, | ||
"invoice_settings/default_payment_method" text, | ||
metadata json, | ||
name text, | ||
phone text, | ||
flow_document json NOT NULL | ||
); | ||
|
||
end; |