summary refs log tree commit diff
path: root/synapse/storage/schema
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-04-10 18:46:09 +0100
committerErik Johnston <erik@matrix.org>2015-04-10 18:46:09 +0100
commit4103b1c4709b374785ffb7eca75c8f338218bc17 (patch)
tree419f1aeb4e1793a9a255138db9ba5d68effa5bee /synapse/storage/schema
parentUse LONGBLOB and TEXT for arbitary length rows (diff)
downloadsynapse-4103b1c4709b374785ffb7eca75c8f338218bc17.tar.xz
DROP indexes before recreating them
Diffstat (limited to 'synapse/storage/schema')
-rw-r--r--synapse/storage/schema/delta/16/unique_constraints.sql8
-rw-r--r--synapse/storage/schema/full_schemas/16/state.sql2
2 files changed, 9 insertions, 1 deletions
diff --git a/synapse/storage/schema/delta/16/unique_constraints.sql b/synapse/storage/schema/delta/16/unique_constraints.sql
index b2b677e510..f9fbb6b448 100644
--- a/synapse/storage/schema/delta/16/unique_constraints.sql
+++ b/synapse/storage/schema/delta/16/unique_constraints.sql
@@ -6,6 +6,7 @@ DELETE FROM current_state_events WHERE rowid not in (
     SELECT MIN(rowid) FROM current_state_events GROUP BY event_id
 );
 
+DROP INDEX IF EXISTS current_state_events_event_id;
 CREATE UNIQUE INDEX current_state_events_event_id ON current_state_events(event_id);
 
 --
@@ -13,6 +14,7 @@ DELETE FROM room_memberships WHERE rowid not in (
     SELECT MIN(rowid) FROM room_memberships GROUP BY event_id
 );
 
+DROP INDEX IF EXISTS room_memberships_event_id;
 CREATE UNIQUE INDEX room_memberships_event_id ON room_memberships(event_id);
 
 --
@@ -20,6 +22,7 @@ DELETE FROM feedback WHERE rowid not in (
     SELECT MIN(rowid) FROM feedback GROUP BY event_id
 );
 
+DROP INDEX IF EXISTS feedback_event_id;
 CREATE UNIQUE INDEX feedback_event_id ON feedback(event_id);
 
 --
@@ -27,6 +30,7 @@ DELETE FROM topics WHERE rowid not in (
     SELECT MIN(rowid) FROM topics GROUP BY event_id
 );
 
+DROP INDEX IF EXISTS topics_event_id;
 CREATE UNIQUE INDEX topics_event_id ON topics(event_id);
 
 --
@@ -34,6 +38,7 @@ DELETE FROM room_names WHERE rowid not in (
     SELECT MIN(rowid) FROM room_names GROUP BY event_id
 );
 
+DROP INDEX IF EXISTS room_names_id;
 CREATE UNIQUE INDEX room_names_id ON room_names(event_id);
 
 --
@@ -41,6 +46,7 @@ DELETE FROM presence WHERE rowid not in (
     SELECT MIN(rowid) FROM presence GROUP BY user_id
 );
 
+DROP INDEX IF EXISTS presence_id;
 CREATE UNIQUE INDEX presence_id ON presence(user_id);
 
 --
@@ -49,6 +55,7 @@ DELETE FROM presence_allow_inbound WHERE rowid not in (
     GROUP BY observed_user_id, observer_user_id
 );
 
+DROP INDEX IF EXISTS presence_allow_inbound_observers;
 CREATE UNIQUE INDEX presence_allow_inbound_observers ON presence_allow_inbound(
     observed_user_id, observer_user_id
 );
@@ -59,6 +66,7 @@ DELETE FROM presence_list WHERE rowid not in (
     GROUP BY user_id, observed_user_id
 );
 
+DROP INDEX IF EXISTS presence_list_observers;
 CREATE UNIQUE INDEX presence_list_observers ON presence_list(
     user_id, observed_user_id
 );
diff --git a/synapse/storage/schema/full_schemas/16/state.sql b/synapse/storage/schema/full_schemas/16/state.sql
index 737c3e35c7..8d6b94a616 100644
--- a/synapse/storage/schema/full_schemas/16/state.sql
+++ b/synapse/storage/schema/full_schemas/16/state.sql
@@ -37,4 +37,4 @@ CREATE INDEX IF NOT EXISTS state_groups_id ON state_groups(id);
 
 CREATE INDEX IF NOT EXISTS state_groups_state_id ON state_groups_state(state_group);
 CREATE INDEX IF NOT EXISTS state_groups_state_tuple ON state_groups_state(room_id, type, state_key);
-CREATE INDEX IF NOT EXISTS event_to_state_groups_id ON event_to_state_groups(event_id);
\ No newline at end of file
+CREATE INDEX IF NOT EXISTS event_to_state_groups_id ON event_to_state_groups(event_id);