You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the migration detects unexpected data, it now logs:
- Each server that would be deleted, with name, version, and reason
- Each server that would have status updated, with current status
This makes it easy to identify new problematic data and update
the migration accordingly if production data changes.
Example output on failure:
```
NOTICE: Servers that would be deleted:
NOTICE: - unexpected.server/[email protected] (reason: Invalid name format)
NOTICE: - another.server@ (reason: Empty version)
ERROR: Safety check failed: Expected to delete exactly 5 servers but would delete 7
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
RAISE EXCEPTION 'Safety check failed: Expected to delete exactly 5 servers but would delete %. Check the log above for details. Aborting to prevent data loss.', total_to_delete;
73
92
END IF;
74
93
75
94
IF invalid_status_count !=1 THEN
76
-
RAISE EXCEPTION 'Safety check failed: Expected to update exactly 1 server status but would update %. Aborting to prevent data corruption.', invalid_status_count;
95
+
-- Log the specific servers that would have status updated
96
+
RAISE NOTICE 'Servers that would have status updated:';
97
+
FOR r IN
98
+
SELECT value->>'name'as name, value->>'version'as version, value->>'status'as status
99
+
FROM servers
100
+
WHERE value->>'status'IS NOT NULL
101
+
AND value->>'status'!=''
102
+
AND value->>'status' NOT IN ('active', 'deprecated', 'deleted')
RAISE EXCEPTION 'Safety check failed: Expected to update exactly 1 server status but would update %. Check the log above for details. Aborting to prevent data corruption.', invalid_status_count;
0 commit comments