first commit

This commit is contained in:
Tomas Dvorak
2026-04-10 12:01:36 +02:00
commit 035ac8ddb5
61 changed files with 6600 additions and 0 deletions
@@ -0,0 +1,23 @@
-- +goose Up
CREATE TABLE IF NOT EXISTS billing_snapshots (
tenant_id uuid PRIMARY KEY REFERENCES tenants(id) ON DELETE CASCADE,
stripe_customer_id text NOT NULL DEFAULT '',
stripe_subscription_id text NOT NULL DEFAULT '',
status text NOT NULL DEFAULT 'none',
plan_code text NOT NULL DEFAULT 'starter',
price_id text NOT NULL DEFAULT '',
cancel_at_period_end boolean NOT NULL DEFAULT false,
current_period_start timestamptz,
current_period_end timestamptz,
payment_method_brand text NOT NULL DEFAULT '',
payment_method_last4 text NOT NULL DEFAULT '',
last_synced_at timestamptz,
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_subscription_events_processed ON subscription_events (processed_at);
-- +goose Down
DROP INDEX IF EXISTS idx_subscription_events_processed;
DROP TABLE IF EXISTS billing_snapshots;