mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-16 11:22:13 -04:00
Clean up schema for event_edges
(#12893)
* Remove redundant references to `event_edges.room_id` We don't need to care about the room_id here, because we are already checking the event id. * Clean up the event_edges table We make a number of changes to `event_edges`: * We give the `room_id` and `is_state` columns defaults (null and false respectively) so that we can stop populating them. * We drop any rows that have `is_state` set true - they should no longer exist. * We drop any rows that do not exist in `events` - these should not exist either. * We drop the old unique constraint on all the colums, which wasn't much use. * We create a new unique index on `(event_id, prev_event_id)`. * We add a foreign key constraint to `events`. These happen rather differently depending on whether we are on Postgres or SQLite. For SQLite, we just rebuild the whole table, copying only the rows we want to keep. For Postgres, we try to do things in the background as much as possible. * Stop populating `event_edges.room_id` and `is_state` We can just rely on the defaults.
This commit is contained in:
parent
a4ae1406d1
commit
75fb10ee45
7 changed files with 216 additions and 11 deletions
|
@ -214,10 +214,10 @@ class PurgeEventsStore(StateGroupWorkerStore, CacheInvalidationWorkerStore):
|
|||
|
||||
# Delete all remote non-state events
|
||||
for table in (
|
||||
"event_edges",
|
||||
"events",
|
||||
"event_json",
|
||||
"event_auth",
|
||||
"event_edges",
|
||||
"event_forward_extremities",
|
||||
"event_relations",
|
||||
"event_search",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue