Files
accounted/supabase/migrations/20260909100100_zettle_sync_capability_backfill.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

23 lines
764 B
SQL

-- Backfill capability_grants for the new 'zettle_sync' capability.
--
-- zettle_sync joins PAID_CAPABILITIES; existing companies' grants were written
-- before this key existed. Mirror each existing bank_sync grant (same sibling
-- used by stripe_payments / woocommerce_sync / shopify_sync backfills).
insert into public.capability_grants
(company_id, team_id, capability_key, source, granted_at, expires_at, metadata)
select
g.company_id,
g.team_id,
'zettle_sync',
g.source,
g.granted_at,
g.expires_at,
jsonb_build_object(
'backfilled_from', 'bank_sync',
'backfill_migration', '20260909100100'
)
from public.capability_grants g
where g.capability_key = 'bank_sync'
on conflict (company_id, team_id, capability_key, source) do nothing;