mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
DROP indexes before recreating them
This commit is contained in:
parent
4d5b098626
commit
4103b1c470
@ -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
|
||||
);
|
||||
|
@ -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);
|
||||
CREATE INDEX IF NOT EXISTS event_to_state_groups_id ON event_to_state_groups(event_id);
|
||||
|
Loading…
Reference in New Issue
Block a user