mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-15 20:00:23 +00:00
Dust off make_full_schema and add CI using it to show schema diffs. (#20027)
It seems a lot of time in our trial tests goes towards setting up the database. (The same is probably true of Complement too) We haven't done a full schema for about 20 schema versions, so no surprise! As a result, I want to produce a full schema soon. In this PR I dust off `make_full_schema.sh` (which seems to have broken after some SQLite changes) and add a CI workflow that runs it (producing a diff) when someone changes the schema. The CI workflow also adds a sticky comment showing the diff on the schema, so you can better appreciate the final effect of a change. --- **Dead changes:** I wanted to make it possible to generate a versioned full schema without the manual work, but you can't run the background updates without essentially starting up a homeserver, at which point it might fail because you haven't run all the deltas yet. There's no actual good way to do this, short of deleting the latest deltas (+ tweaking code to not crash without them) or rolling back in the git history. Backed out those changes, but they're preserved on the PR if interesting. --------- Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
This commit is contained in:
@@ -84,17 +84,11 @@ reference only.
|
||||
If you want to recreate these schemas, they need to be made from a database that
|
||||
has had all background updates run.
|
||||
|
||||
To do so, use `scripts-dev/make_full_schema.sh`. This will produce new
|
||||
`full.sql.postgres` and `full.sql.sqlite` files.
|
||||
To do so, use the `make_full_schema.sh` script. This will produce new
|
||||
`full.sql.postgres` and `full.sql.sqlite` files, after having applied ALL
|
||||
schema deltas and background updates.
|
||||
|
||||
Ensure postgres is installed, then run:
|
||||
|
||||
```sh
|
||||
./scripts-dev/make_full_schema.sh -p postgres_username -o output_dir/
|
||||
```
|
||||
|
||||
NB at the time of writing, this script predates the split into separate `state`/`main`
|
||||
databases so will require updates to handle that correctly.
|
||||
Run `poetry run scripts-dev/make_full_schema.sh -h` for usage instructions.
|
||||
|
||||
## Delta files
|
||||
|
||||
|
||||
Reference in New Issue
Block a user