Skip to content

Commit f81261e

Browse files
committed
Add helper queries
1 parent eb9b434 commit f81261e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ CREATE TABLE migrate_serialized_queue_unsandboxed (
4848
-- ON CONFLICT DO NOTHING;
4949

5050

51-
--- Sanity Checks
51+
--- Sanity Checks, If all has gone well, these should all return 0 or no results respectively.
5252
-- SELECT COUNT(*) FROM migrate_serialized_queue_sandboxed;
5353
-- SELECT COUNT(*) FROM migrate_serialized_queue_unsandboxed;
5454

@@ -63,3 +63,14 @@ CREATE TABLE migrate_serialized_queue_unsandboxed (
6363
-- FROM sandboxed_types st
6464
-- JOIN types t ON st.type_id = t.id
6565
-- WHERE NOT EXISTS(SELECT FROM serialized_components sc WHERE sc.user_id = st.user_id AND sc.component_hash_id = t.component_hash_id);
66+
67+
68+
-- EXTRA
69+
70+
-- If some components were somehow missing, this will detect which ones still need processing and add them back to
71+
-- the queue.
72+
-- INSERT INTO migrate_serialized_queue_sandboxed (component_hash_id, user_id)
73+
-- SELECT DISTINCT ON (sd.component_hash_id, sd.component_summary_digest) sd.component_hash_id, sd.user_id
74+
-- FROM user_component_summary_digest sd
75+
-- WHERE NOT EXISTS(SELECT FROM component_summary_digests_to_serialized_component_bytes_hash csd WHERE csd.component_summary_digest = sd.component_summary_digest AND csd.component_hash_id = sd.component_hash_id)
76+
-- ;

0 commit comments

Comments
 (0)