summary refs log tree commit diff
path: root/scripts-dev
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2022-06-15 12:29:42 +0100
committerGitHub <noreply@github.com>2022-06-15 12:29:42 +0100
commit75fb10ee45950a175ee286b36fb5a46f123d7db5 (patch)
tree6e8283206657ac86a16cd19f1ddc1f3bf61fd301 /scripts-dev
parentFix typechecks against twisted trunk (#13061) (diff)
downloadsynapse-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 'scripts-dev')
0 files changed, 0 insertions, 0 deletions