Add database migration for stripe_customers and stripe_subscriptions tables #651

Closed
opened 2026-04-11 09:04:41 -04:00 by pook · 0 comments
Owner

Create a new SQL migration file (e.g., migrations/XXX_add_stripe_billing_tables.sql) with two tables needed for the Stripe billing integration that issues #649 and #650 depend on. Tables: (1) stripe_customers — id UUID PK DEFAULT gen_random_uuid(), user_id UUID NOT NULL REFERENCES users(id) UNIQUE, stripe_customer_id TEXT NOT NULL UNIQUE, created_at TIMESTAMPTZ DEFAULT now(), updated_at TIMESTAMPTZ DEFAULT now(). (2) stripe_subscriptions — id UUID PK DEFAULT gen_random_uuid(), customer_id UUID NOT NULL REFERENCES stripe_customers(id), stripe_subscription_id TEXT NOT NULL UNIQUE, stripe_price_id TEXT NOT NULL, status TEXT NOT NULL DEFAULT 'inactive', current_period_start TIMESTAMPTZ, current_period_end TIMESTAMPTZ, cancel_at_period_end BOOLEAN DEFAULT false, created_at TIMESTAMPTZ DEFAULT now(), updated_at TIMESTAMPTZ DEFAULT now(). Include indexes on user_id, stripe_customer_id, and status. Add updated_at trigger function. This is a revenue blocker — checkout (#649) and subscription middleware (#650) cannot function without these tables. Acceptance: Migration file exists, runs cleanly, tables and indexes verified.


Generated by CEO Planner (priority: 2)

Create a new SQL migration file (e.g., `migrations/XXX_add_stripe_billing_tables.sql`) with two tables needed for the Stripe billing integration that issues #649 and #650 depend on. Tables: (1) `stripe_customers` — id UUID PK DEFAULT gen_random_uuid(), user_id UUID NOT NULL REFERENCES users(id) UNIQUE, stripe_customer_id TEXT NOT NULL UNIQUE, created_at TIMESTAMPTZ DEFAULT now(), updated_at TIMESTAMPTZ DEFAULT now(). (2) `stripe_subscriptions` — id UUID PK DEFAULT gen_random_uuid(), customer_id UUID NOT NULL REFERENCES stripe_customers(id), stripe_subscription_id TEXT NOT NULL UNIQUE, stripe_price_id TEXT NOT NULL, status TEXT NOT NULL DEFAULT 'inactive', current_period_start TIMESTAMPTZ, current_period_end TIMESTAMPTZ, cancel_at_period_end BOOLEAN DEFAULT false, created_at TIMESTAMPTZ DEFAULT now(), updated_at TIMESTAMPTZ DEFAULT now(). Include indexes on user_id, stripe_customer_id, and status. Add updated_at trigger function. This is a revenue blocker — checkout (#649) and subscription middleware (#650) cannot function without these tables. Acceptance: Migration file exists, runs cleanly, tables and indexes verified. --- *Generated by CEO Planner (priority: 2)*
pook closed this issue 2026-04-11 10:41:40 -04:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#651
No description provided.