Skip to content

v0.158.2: fix(db): capture 2 orphan prod migrations into version control

Choose a tag to compare

@github-actions github-actions released this 22 Jun 18:52

fix(db): capture 2 orphan prod migrations into version control

What

Two PL/pgSQL functions were live on production (Cloud zmlluqqqwrfhygvpfqka) but existed nowhere in the repo — applied directly via the Supabase MCP and never committed. This captures them verbatim from prod schema_migrations under their original version strings, so the repo and prod line up.

  • 20260622121619_fix_handle_new_user_invite_email_matchhandle_new_user() now matches shadow profiles by invite_email (placeholder-email shadows), so accepting an invite links the existing profile instead of creating a blank account and orphaning lesson history.
  • 20260622121836_fix_track_lesson_changes_deletetrack_lesson_changes() wraps the AFTER-DELETE audit insert in an exception block so lesson deletions are never blocked by the lesson_history FK.

Why

Surfaced by a Cloud↔repo migration-history diff while planning the Cloud→self-host migration. These were the only prod-only, version-controlled-nowhere changes — losing them in any rebuild-from-repo would silently regress the invite flow and lesson deletes. This is additive (idempotent CREATE OR REPLACE FUNCTION), no schema/data change.

Verification

  • SQL validated by applying both inside a rolled-back transaction on the dev DB (both CREATE FUNCTION, clean ROLLBACK).
  • Pre-commit hook green: 209 suites / 2831 tests + lint.

🤖 Generated with Claude Code


Full Changelog: v0.158.1...v0.158.2
Merged PR: #515