Files
dbis_core/scripts/sql/fix-iru-inquiry-offering-fk.sql
defiQUG 6ebf71dda8 feat: SolaceNet gateway rails, IRU marketplace hardening, and docs
- Gateway adapter registry, rails routes, optional SOLACENET_GATEWAY_RAILS_ENFORCE; HTTP integration tests.
- IRU marketplace: rate limits, public routes, notifications/SMTP env docs; marketplace UI constants and flows.
- Quantum proxy legacy protocol types; debank/tezos/GSDS touch-ups; .env.example operator notes.
- SolaceNet doc set (gaps, runbooks, telecom schema example).

Tests: npm run test:iru-marketplace, npm run test:gateway (pass).
Note: full-repo tsc still reports unrelated legacy errors outside this change set.
Made-with: Cursor
2026-04-07 23:21:55 -07:00

20 lines
720 B
PL/PgSQL

-- Repair IruInquiry.offeringId when it incorrectly stores IruOffering.offeringId (business code)
-- instead of IruOffering.id (UUID). FK: IruInquiry.offeringId -> IruOffering.id
--
-- Review affected rows first:
-- SELECT i."inquiryId", i."offeringId" AS broken_fk, o.id AS correct_uuid, o."offeringId" AS business_id
-- FROM "IruInquiry" i
-- INNER JOIN "IruOffering" o ON o."offeringId" = i."offeringId"
-- WHERE i."offeringId" <> o.id;
--
-- Apply (transaction recommended):
-- BEGIN;
-- \i scripts/sql/fix-iru-inquiry-offering-fk.sql
-- COMMIT;
UPDATE "IruInquiry" AS i
SET "offeringId" = o.id
FROM "IruOffering" AS o
WHERE o."offeringId" = i."offeringId"
AND i."offeringId" IS DISTINCT FROM o.id;