@@ -67,6 +67,40 @@ CREATE TABLE migrate_serialized_queue_unsandboxed (
6767
6868-- EXTRA
6969
70+ -- If some causals are missing:
71+ -- INSERT INTO migrate_serialized_queue_unsandboxed (hash, user_id)
72+ -- SELECT DISTINCT ON(c.hash) c.hash, co.user_id
73+ -- FROM causal_ownership co
74+ -- JOIN causals c ON co.causal_id = c.id
75+ -- WHERE NOT EXISTS(SELECT FROM serialized_causals sc WHERE sc.causal_id = c.id)
76+ -- ;
77+
78+
79+ -- If some namespaces are missing:
80+ -- INSERT INTO migrate_serialized_queue_unsandboxed (hash, user_id)
81+ -- SELECT DISTINCT ON(bh.base32) bh.base32, no.user_id
82+ -- FROM namespace_ownership no
83+ -- JOIN branch_hashes bh ON no.namespace_hash_id = bh.id
84+ -- WHERE NOT EXISTS(SELECT FROM serialized_namespaces sn WHERE sn.namespace_hash_id = bh.id)
85+ -- ;
86+
87+ -- If some term components are missing
88+ -- INSERT INTO migrate_serialized_queue_sandboxed (component_hash_id, user_id)
89+ -- SELECT DISTINCT ON (t.component_hash_id) t.component_hash_id, st.user_id
90+ -- FROM sandboxed_terms st
91+ -- JOIN terms t ON st.term_id = t.id
92+ -- WHERE NOT EXISTS(SELECT FROM serialized_components sc WHERE sc.user_id = st.user_id AND sc.component_hash_id = t.component_hash_id)
93+ -- ;
94+
95+ -- If some type components are missing
96+ -- INSERT INTO migrate_serialized_queue_sandboxed (component_hash_id, user_id)
97+ -- SELECT DISTINCT ON (t.component_hash_id) t.component_hash_id, st.user_id
98+ -- FROM sandboxed_types st
99+ -- JOIN types t ON st.type_id = t.id
100+ -- WHERE NOT EXISTS(SELECT FROM serialized_components sc WHERE sc.user_id = st.user_id AND sc.component_hash_id = t.component_hash_id)
101+ -- ;
102+
103+
70104-- If some components were somehow missing, this will detect which ones still need processing and add them back to
71105-- the queue.
72106-- INSERT INTO migrate_serialized_queue_sandboxed (component_hash_id, user_id)
0 commit comments