Files
accounted/supabase/migrations/20260723200000_stripe_transaction_sync.sql
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

26 lines
1.4 KiB
SQL

-- Stripe balance-transaction sync (the "Stripe balance as a bank feed" feature).
--
-- Balance transactions from the connected account land in the transactions
-- inbox as feed rows on a 1686 cash account (see
-- extensions/general/stripe/lib/transaction-sync.ts). Two new columns on
-- stripe_connections drive it:
--
-- - transaction_sync_enabled: per-connection opt-in. Off by default: a
-- company using only invoice payment links should not suddenly get a
-- second feed in its inbox.
-- - last_balance_txn_synced_at: polling cursor (max balance-transaction
-- `created` processed). The sync re-polls with a 24h overlap and relies on
-- the (company_id, external_id) unique index on transactions for
-- idempotency, mirroring last_event_created_at for the event sync.
alter table public.stripe_connections
add column transaction_sync_enabled boolean not null default false,
add column last_balance_txn_synced_at timestamptz;
comment on column public.stripe_connections.transaction_sync_enabled is
'Opt-in: import the connected account''s balance transactions into the transactions inbox (Stripe balance as a bank feed).';
comment on column public.stripe_connections.last_balance_txn_synced_at is
'Balance-transaction polling cursor (max created processed); the sync overlaps it by 24h and dedups on external_id.';
NOTIFY pgrst, 'reload schema';