summary refs log tree commit diff
path: root/synapse/storage/schema/delta
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-04-10 18:47:03 +0100
committerErik Johnston <erik@matrix.org>2015-04-10 18:47:03 +0100
commit93937b2b313e5b1020d21f3f2cad404ecff659c2 (patch)
tree5abd10c0ce1e7aa031dc53fe94f2d472bbcebfdb /synapse/storage/schema/delta
parentUse case sensitive collations (diff)
downloadsynapse-93937b2b313e5b1020d21f3f2cad404ecff659c2.tar.xz
Remove duplicate rows
Diffstat (limited to 'synapse/storage/schema/delta')
-rw-r--r--synapse/storage/schema/delta/16/remove_duplicates.sql9
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/storage/schema/delta/16/remove_duplicates.sql b/synapse/storage/schema/delta/16/remove_duplicates.sql
new file mode 100644
index 0000000000..65c97b5e2f
--- /dev/null
+++ b/synapse/storage/schema/delta/16/remove_duplicates.sql
@@ -0,0 +1,9 @@
+
+
+DELETE FROM event_to_state_groups WHERE state_group not in (
+    SELECT MAX(state_group) FROM event_to_state_groups GROUP BY event_id
+);
+
+DELETE FROM event_to_state_groups WHERE rowid not in (
+    SELECT MIN(rowid) FROM event_to_state_groups GROUP BY event_id
+);