Files
accounted/supabase/migrations/20260707113729_add_transactions_enrichment.sql
Mattsson 8dde46ad96 fix(db): reconcile prod-orphaned migrations blocking Supabase branching (#942)
* fix(db): reconcile prod-orphaned migrations blocking Supabase branching

Prod's schema_migrations carries three versions with no committed file on
main, leaving the default Supabase branch in MIGRATIONS_FAILED and stopping
preview branches from being created:

  20260707113729  add_transactions_enrichment    (adopted from #927)
  20260708120000  ledger_stats_committed_at_lag  (adopted from #935)
  20260708130000  ledger_deep_context            (adopted from #935)

Adopt the byte-identical SQL under the exact apply-time versions, plus the
matching pg-tests and fixtures for the two RPCs so pg-real stays green:
20260708120000 switches get_ledger_usage_stats' median_booking_lag_days to
committed_at, so the existing test now asserts the new behavior. Idempotent
(ADD COLUMN IF NOT EXISTS / CREATE OR REPLACE FUNCTION): no-op on prod,
clean on fresh replays, no-op on #927/#935's next rebase. The knowledge-page
UI/lib/i18n stay in #935.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(deps): pin @anthropic-ai/bedrock-sdk to 0.29.1

0.32.0 (grouped dependabot bump #884) broke Bedrock streaming in prod: empty stream / "request ended without sending any chunks", taking down the in-app AI assistant and invoice OCR. Local dev ran the stale 0.29.1 in node_modules, so it only failed on deploys built fresh from the lockfile. Revert to the six-week-stable 0.29.1; creds/region were never the cause (proven AKIA key + eu-west-1).

Guard against an accidental re-bump three ways: exact pin (no caret), a dependabot ignore, and a pinned-dep check in scripts/checks/no-new-antipatterns.mjs (check:guards). Unpin only once 0.32.x streaming is verified against Bedrock. See DECISIONS.md.
2026-07-08 23:54:49 +02:00

18 lines
934 B
SQL

-- Third-party transaction enrichment (Gokind counterparty identification).
-- Stores a trimmed projection of the enrichment response, not the raw payload:
-- { provider, fetched_at, identified, counterparty { id, name, org_numbers,
-- logo_url }, industries [], tags [], flags [], payment { subscription,
-- vendor_name } }
-- Nullable: enrichment is optional and fail-soft; rows ingested while the
-- provider is unconfigured or unavailable simply have NULL here.
--
-- Adopted reconciliation migration: this SQL was applied directly to prod on
-- 2026-07-07 (apply-time version 20260707113729) but the file was never
-- committed. Committed after the fact so the prod migration ledger and the
-- repo agree; prod already has the column, so this only runs on fresh
-- branches and staging. See DECISIONS.md 2026-07-08.
ALTER TABLE public.transactions
ADD COLUMN IF NOT EXISTS enrichment jsonb;
NOTIFY pgrst, 'reload schema';