diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2022-06-15 12:29:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-15 12:29:42 +0100 |
commit | 75fb10ee45950a175ee286b36fb5a46f123d7db5 (patch) | |
tree | 6e8283206657ac86a16cd19f1ddc1f3bf61fd301 /changelog.d/12893.misc | |
parent | Fix typechecks against twisted trunk (#13061) (diff) | |
download | synapse-75fb10ee45950a175ee286b36fb5a46f123d7db5.tar.xz |
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.
Diffstat (limited to 'changelog.d/12893.misc')
-rw-r--r-- | changelog.d/12893.misc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/changelog.d/12893.misc b/changelog.d/12893.misc new file mode 100644 index 0000000000..5705210303 --- /dev/null +++ b/changelog.d/12893.misc @@ -0,0 +1 @@ +Simplify the database schema for `event_edges`. |