summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-21 15:52:44 +0100
committerErik Johnston <erik@matrix.org>2016-09-21 15:52:44 +0100
commitdc78db8c5641513ff01276ca50070a8d46ebce36 (patch)
treeec86c423f602cbacdaef8ee9e6c341daea9be6c9 /synapse
parentReadd entries to public_room_list_stream that were deleted (diff)
downloadsynapse-dc78db8c5641513ff01276ca50070a8d46ebce36.tar.xz
Update correct table
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/schema/delta/36/readd_public_rooms.sql16
1 files changed, 10 insertions, 6 deletions
diff --git a/synapse/storage/schema/delta/36/readd_public_rooms.sql b/synapse/storage/schema/delta/36/readd_public_rooms.sql
index 0de7e326d2..5460a350b6 100644
--- a/synapse/storage/schema/delta/36/readd_public_rooms.sql
+++ b/synapse/storage/schema/delta/36/readd_public_rooms.sql
@@ -13,10 +13,14 @@
  * limitations under the License.
  */
 
-
-INSERT INTO public_room_list_stream (stream_id, room_id, visibility)
-    SELECT 1, room_id, is_public FROM rooms AS r
-    WHERE is_public = CAST(1 AS BOOLEAN)
-    AND NOT EXISTS (
-        SELECT room_id FROM stream_ordering_to_exterm WHERE room_id = r.room_id
+-- Re-add some entries to stream_ordering_to_exterm that were incorrectly deleted
+INSERT INTO stream_ordering_to_exterm (stream_ordering, room_id, event_id)
+    SELECT
+        (SELECT max(stream_ordering) FROM events where room_id = e.room_id) AS stream_ordering,
+        room_id,
+        event_id
+    FROM event_forward_extremities AS e
+    WHERE NOT EXISTS (
+        SELECT room_id FROM stream_ordering_to_exterm AS s
+        WHERE s.room_id = e.room_id
     );