mirror of https://github.com/watcha-fr/synapse
Reorganise the database schema directories (#9932)
The hope here is that by moving all the schema files into synapse/storage/schema, it gets a bit easier for newcomers to navigate. It certainly got easier for me to write a helpful README. There's more to do on that front, but I'll follow up with other PRs for that.code_spécifique_watcha
parent
8771b1337d
commit
25f43faa70
@ -0,0 +1 @@ |
||||
Move database schema files into a common directory. |
@ -1,21 +0,0 @@ |
||||
# Synapse Database Schemas |
||||
|
||||
These schemas are used as a basis to create brand new Synapse databases, on both |
||||
SQLite3 and Postgres. |
||||
|
||||
## Building full schema dumps |
||||
|
||||
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. |
||||
|
||||
Ensure postgres is installed and your user has the ability to run bash commands |
||||
such as `createdb`, then call |
||||
|
||||
./scripts-dev/make_full_schema.sh -p postgres_username -o output_dir/ |
||||
|
||||
There are currently two folders with full-schema snapshots. `16` is a snapshot |
||||
from 2015, for historical reference. The other contains the most recent full |
||||
schema snapshot. |
@ -0,0 +1,37 @@ |
||||
# Synapse Database Schemas |
||||
|
||||
This directory contains the schema files used to build Synapse databases. |
||||
|
||||
Synapse supports splitting its datastore across multiple physical databases (which can |
||||
be useful for large installations), and the schema files are therefore split according |
||||
to the logical database they are apply to. |
||||
|
||||
At the time of writing, the following "logical" databases are supported: |
||||
|
||||
* `state` - used to store Matrix room state (more specifically, `state_groups`, |
||||
their relationships and contents.) |
||||
* `main` - stores everything else. |
||||
|
||||
Addionally, the `common` directory contains schema files for tables which must be |
||||
present on *all* physical databases. |
||||
|
||||
## Full schema dumps |
||||
|
||||
In the `full_schemas` directories, only the most recently-numbered snapshot is useful |
||||
(`54` at the time of writing). Older snapshots (eg, `16`) are present for historical |
||||
reference only. |
||||
|
||||
## Building full schema dumps |
||||
|
||||
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. |
||||
|
||||
Ensure postgres is installed, then run: |
||||
|
||||
./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. |
@ -0,0 +1,17 @@ |
||||
# Copyright 2021 The Matrix.org Foundation C.I.C. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
# Remember to update this number every time a change is made to database |
||||
# schema files, so the users will be informed on server restarts. |
||||
SCHEMA_VERSION = 59 |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue