0027 had already run in production in its first form; changing it made the backend refuse to start. It is back as it was, and the payment details and the invoices table come in 0028. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
17 lines
786 B
SQL
17 lines
786 B
SQL
-- Stripe Checkout sessions started from the package cards. The package is
|
|
-- granted once, when the payment is confirmed (webhook, or the return page
|
|
-- asking Stripe), and the session id keeps that from happening twice.
|
|
CREATE TABLE stripe_checkouts (
|
|
-- Stripe's Checkout Session id (cs_test_… / cs_live_…).
|
|
id text PRIMARY KEY,
|
|
user_id uuid NOT NULL REFERENCES users ON DELETE CASCADE,
|
|
package text NOT NULL,
|
|
price_huf integer NOT NULL CHECK (price_huf > 0),
|
|
live boolean NOT NULL,
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
completed_at timestamptz,
|
|
order_id uuid REFERENCES package_orders ON DELETE SET NULL
|
|
);
|
|
|
|
CREATE INDEX stripe_checkouts_user_idx ON stripe_checkouts (user_id, created_at DESC);
|