Skip to content

Commit 7ea7a61

Browse files
committed
Add migration sanity checks
1 parent 9e4020d commit 7ea7a61

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

sql/2025-01-24_migrate-serialized-entities.sql

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,19 @@ CREATE TABLE migrate_serialized_queue_unsandboxed (
4747
-- ON summaries.component_summary_digest = serialized.component_summary_digest AND summaries.component_hash_id = serialized.component_hash_id
4848
-- ON CONFLICT DO NOTHING;
4949

50+
51+
--- Sanity Checks
52+
-- SELECT COUNT(*) FROM migrate_serialized_queue_sandboxed;
53+
-- SELECT COUNT(*) FROM migrate_serialized_queue_unsandboxed;
54+
55+
-- SELECT c.id FROM causals c WHERE NOT EXISTS(SELECT FROM serialized_causals sc WHERE sc.causal_id = c.id);
56+
-- SELECT n.namespace_hash_id FROM namespaces n WHERE NOT EXISTS(SELECT FROM serialized_namespaces sn WHERE sn.namespace_hash_id = n.namespace_hash_id);
57+
-- SELECT p.id FROM patches p WHERE NOT EXISTS(SELECT FROM serialized_patches sp WHERE sp.patch_id = p.id);
58+
-- SELECT st.user_id, t.component_hash_id
59+
-- FROM sandboxed_terms st
60+
-- JOIN terms t ON st.term_id = t.id
61+
-- WHERE NOT EXISTS(SELECT FROM serialized_components sc WHERE sc.user_id = st.user_id AND sc.component_hash_id = t.component_hash_id);
62+
-- SELECT st.user_id, t.component_hash_id
63+
-- FROM sandboxed_types st
64+
-- JOIN types t ON st.type_id = t.id
65+
-- WHERE NOT EXISTS(SELECT FROM serialized_components sc WHERE sc.user_id = st.user_id AND sc.component_hash_id = t.component_hash_id);

0 commit comments

Comments
 (0)