• v1.2.1 2d49e5b68c

    Ghost released this 2025-09-30 09:43:26 -04:00 | 405 commits to main since this release

    Summary

    • Fixes migration 008 failing with "column contains null values" error
    • Adds COALESCE protection to handle 126 servers without status fields
    • Includes test utilities to reproduce and verify fixes with production
      data

    Problem

    Migration 008 was failing in production because:

    • 126 out of 781 servers have no status field in their JSON
    • When extracting rec.value->>'status', these became NULL values
    • The ALTER TABLE servers ALTER COLUMN status SET NOT NULL constraint
      then failed

    Solution

    1. Prevent NULLs during migration: Use COALESCE to provide 'active'
      default when status is NULL/empty
    2. Enhanced debugging: Added RAISE NOTICE statements to log
      problematic values
    3. Safety check: Double-check that throws exception if any NULLs
      remain
    4. Test utilities: Created mirror_data tools to test migrations with
      real production data

    Testing

    Created and used scripts/mirror_data/ tools to:

    • Fetch all 781 servers from production API
    • Load them into a test database
    • Verify the migration fix works correctly

    Results:

    • Before fix: 126 NULL status values created during migration
    • After fix: 0 NULL status values, all servers have valid status
    • Migration completes successfully with NOT NULL constraint

    Test plan

    • Tested locally with production data using mirror_data tools
    • Verified 0 NULL values after migration (vs 126 before)
    • Confirmed NOT NULL constraint adds successfully
    • Deploy to staging and verify migration succeeds
    • Monitor production deployment

    🤖 Generated with Claude Code

    Co-authored-by: Claude noreply@anthropic.com

    Downloads