Skip to content

Commit 4e6ed53

Browse files
fix(schema): replace dead stripe columns with provider_id columns on products
Dropped stripe_product_id and stripe_price_id (added in 20260201, superseded in 20260207 by the generic payment_provider column — but never cleaned up). All rows were NULL and no application code referenced them on products. Added the missing provider_product_id and provider_price_id columns that the createProduct / updateProduct server actions have always tried to write. Without them, any admin form product creation returned PGRST204 "column does not exist". These columns are provider-agnostic: Stripe stores real IDs, manual provider stores a local mock ID, PayPal would store its equivalent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 72f71ce commit 4e6ed53

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- Drop dead stripe_product_id and stripe_price_id columns from products.
2+
--
3+
-- These were the original Stripe-specific columns added in
4+
-- 20260201145244_admin_dashboard_setup.sql. Migration
5+
-- 20260207190849_add_payment_provider_to_products.sql replaced them with
6+
-- the generic provider_product_id / provider_price_id columns that support
7+
-- Stripe, PayPal, manual, and any future provider.
8+
--
9+
-- All rows have NULL values. No application code references these columns
10+
-- on the products table (the identically-named columns on the plans table
11+
-- are separate and remain untouched).
12+
13+
ALTER TABLE public.products
14+
DROP COLUMN IF EXISTS stripe_product_id,
15+
DROP COLUMN IF EXISTS stripe_price_id;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- Add provider_product_id and provider_price_id to products.
2+
--
3+
-- Migration 20260207190849 added the payment_provider column but never added
4+
-- the two ID columns the createProduct / updateProduct server actions write.
5+
-- Without them, any INSERT or UPDATE that includes these fields returns
6+
-- PGRST204 ("column does not exist"), making product creation from the admin
7+
-- form completely broken.
8+
--
9+
-- These replace the old stripe_product_id / stripe_price_id columns (dropped
10+
-- in 20260518150000) with a provider-agnostic pair that works for Stripe,
11+
-- PayPal, and manual (where they hold a local mock ID).
12+
13+
ALTER TABLE public.products
14+
ADD COLUMN IF NOT EXISTS provider_product_id TEXT,
15+
ADD COLUMN IF NOT EXISTS provider_price_id TEXT;

0 commit comments

Comments
 (0)