Add stripe integration

This commit is contained in:
Corey Blais
2026-04-16 20:25:21 -04:00
parent 3a0e30085c
commit c757132cbd
13 changed files with 462 additions and 12 deletions
+12
View File
@@ -19,6 +19,8 @@ export const ensureSchema = async (database: DatabaseClient = db) => {
billing_email VARCHAR(255),
billing_plan VARCHAR(32) NOT NULL DEFAULT 'household_basic',
subscription_status VARCHAR(32) NOT NULL DEFAULT 'active',
stripe_customer_id VARCHAR(255),
stripe_subscription_id VARCHAR(255),
rescue_verification_status VARCHAR(32) NOT NULL DEFAULT 'not_required',
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
@@ -31,8 +33,18 @@ export const ensureSchema = async (database: DatabaseClient = db) => {
ADD COLUMN IF NOT EXISTS billing_email VARCHAR(255),
ADD COLUMN IF NOT EXISTS billing_plan VARCHAR(32) NOT NULL DEFAULT 'household_basic',
ADD COLUMN IF NOT EXISTS subscription_status VARCHAR(32) NOT NULL DEFAULT 'active',
ADD COLUMN IF NOT EXISTS stripe_customer_id VARCHAR(255),
ADD COLUMN IF NOT EXISTS stripe_subscription_id VARCHAR(255),
ADD COLUMN IF NOT EXISTS rescue_verification_status VARCHAR(32) NOT NULL DEFAULT 'not_required';
CREATE UNIQUE INDEX IF NOT EXISTS idx_workspaces_stripe_subscription_id
ON workspaces (stripe_subscription_id)
WHERE stripe_subscription_id IS NOT NULL;
CREATE INDEX IF NOT EXISTS idx_workspaces_stripe_customer_id
ON workspaces (stripe_customer_id)
WHERE stripe_customer_id IS NOT NULL;
UPDATE workspaces
SET rescue_verification_status = 'pending'
WHERE workspace_type = 'rescue'