Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
-- +goose Up
|
||||
-- Stripe customer / subscription linkage + webhook idempotency (company-scoped).
|
||||
|
||||
ALTER TABLE companies
|
||||
ADD COLUMN IF NOT EXISTS stripe_customer_id TEXT;
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS companies_stripe_customer_id_uidx
|
||||
ON companies (stripe_customer_id)
|
||||
WHERE stripe_customer_id IS NOT NULL AND stripe_customer_id <> '';
|
||||
|
||||
ALTER TABLE company_plans
|
||||
ADD COLUMN IF NOT EXISTS stripe_subscription_id TEXT,
|
||||
ADD COLUMN IF NOT EXISTS stripe_price_id TEXT;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS company_plans_stripe_subscription_id_idx
|
||||
ON company_plans (stripe_subscription_id)
|
||||
WHERE stripe_subscription_id IS NOT NULL AND stripe_subscription_id <> '';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS stripe_webhook_events (
|
||||
event_id TEXT PRIMARY KEY,
|
||||
event_type TEXT NOT NULL,
|
||||
company_id UUID REFERENCES companies(id) ON DELETE SET NULL,
|
||||
processed_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE IF EXISTS stripe_webhook_events;
|
||||
DROP INDEX IF EXISTS company_plans_stripe_subscription_id_idx;
|
||||
ALTER TABLE company_plans DROP COLUMN IF EXISTS stripe_price_id;
|
||||
ALTER TABLE company_plans DROP COLUMN IF EXISTS stripe_subscription_id;
|
||||
DROP INDEX IF EXISTS companies_stripe_customer_id_uidx;
|
||||
ALTER TABLE companies DROP COLUMN IF EXISTS stripe_customer_id;
|
||||
Reference in New Issue
Block a user