|
| 1 | + |
| 2 | +DO $$ |
| 3 | +BEGIN |
| 4 | + IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'invoice_status') THEN |
| 5 | + create type "stripe"."invoice_status" as enum ('draft', 'open', 'paid', 'uncollectible', 'void'); |
| 6 | + END IF; |
| 7 | +END |
| 8 | +$$; |
| 9 | + |
| 10 | + |
| 11 | +create table if not exists "stripe"."invoices" ( |
| 12 | + "id" text primary key, |
| 13 | + "object" text, |
| 14 | + "auto_advance" boolean, |
| 15 | + "collection_method" text, |
| 16 | + "currency" text, |
| 17 | + "description" text, |
| 18 | + "hosted_invoice_url" text, |
| 19 | + "lines" jsonb, |
| 20 | + "metadata" jsonb, |
| 21 | + "period_end" integer, |
| 22 | + "period_start" integer, |
| 23 | + "status" "stripe"."invoice_status", |
| 24 | + "total" bigint, |
| 25 | + "account_country" text, |
| 26 | + "account_name" text, |
| 27 | + "account_tax_ids" jsonb, |
| 28 | + "amount_due" bigint, |
| 29 | + "amount_paid" bigint, |
| 30 | + "amount_remaining" bigint, |
| 31 | + "application_fee_amount" bigint, |
| 32 | + "attempt_count" integer, |
| 33 | + "attempted" boolean, |
| 34 | + "billing_reason" text, |
| 35 | + "created" integer, |
| 36 | + "custom_fields" jsonb, |
| 37 | + "customer_address" jsonb, |
| 38 | + "customer_email" text, |
| 39 | + "customer_name" text, |
| 40 | + "customer_phone" text, |
| 41 | + "customer_shipping" jsonb, |
| 42 | + "customer_tax_exempt" text, |
| 43 | + "customer_tax_ids" jsonb, |
| 44 | + "default_tax_rates" jsonb, |
| 45 | + "discount" jsonb, |
| 46 | + "discounts" jsonb, |
| 47 | + "due_date" integer, |
| 48 | + "ending_balance" integer, |
| 49 | + "footer" text, |
| 50 | + "invoice_pdf" text, |
| 51 | + "last_finalization_error" jsonb, |
| 52 | + "livemode" boolean, |
| 53 | + "next_payment_attempt" integer, |
| 54 | + "number" text, |
| 55 | + "paid" boolean, |
| 56 | + "payment_settings" jsonb, |
| 57 | + "post_payment_credit_notes_amount" integer, |
| 58 | + "pre_payment_credit_notes_amount" integer, |
| 59 | + "receipt_number" text, |
| 60 | + "starting_balance" integer, |
| 61 | + "statement_descriptor" text, |
| 62 | + "status_transitions" jsonb, |
| 63 | + "subtotal" integer, |
| 64 | + "tax" integer, |
| 65 | + "total_discount_amounts" jsonb, |
| 66 | + "total_tax_amounts" jsonb, |
| 67 | + "transfer_data" jsonb, |
| 68 | + "webhooks_delivered_at" integer, |
| 69 | + |
| 70 | + "customer" text references "stripe"."customers", |
| 71 | + "subscription" text references "stripe"."subscriptions", |
| 72 | + "payment_intent" text, -- not yet implemented |
| 73 | + "default_payment_method" text, -- not yet implemented |
| 74 | + "default_source" text, -- not yet implemented |
| 75 | + "on_behalf_of" text, -- not yet implemented |
| 76 | + "charge" text -- not yet implemented |
| 77 | +); |
0 commit comments