From 16a4d430a4a15d18f912fc6671a619020d9db2f7 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Sun, 12 Apr 2026 13:14:41 +0800 Subject: [PATCH] feat: add billing source sync state schema --- sql/20260401_accounting_control_plane.sql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sql/20260401_accounting_control_plane.sql b/sql/20260401_accounting_control_plane.sql index 01f1135..979b9f2 100644 --- a/sql/20260401_accounting_control_plane.sql +++ b/sql/20260401_accounting_control_plane.sql @@ -67,6 +67,15 @@ CREATE TABLE IF NOT EXISTS public.account_billing_profiles ( updated_at TIMESTAMPTZ NOT NULL DEFAULT now() ); +CREATE TABLE IF NOT EXISTS public.billing_source_sync_state ( + source_id TEXT PRIMARY KEY, + last_completed_until TIMESTAMPTZ NULL, + last_attempted_at TIMESTAMPTZ NULL, + last_succeeded_at TIMESTAMPTZ NULL, + last_error TEXT NOT NULL DEFAULT '', + updated_at TIMESTAMPTZ NOT NULL DEFAULT now() +); + CREATE TABLE IF NOT EXISTS public.account_policy_snapshots ( account_uuid UUID PRIMARY KEY REFERENCES public.users(uuid) ON DELETE CASCADE, policy_version TEXT NOT NULL,