diff options
author | Shay <hillerys@element.io> | 2023-04-28 10:59:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-28 10:59:00 -0700 |
commit | eb6f8dc2152bab6e602a9617bd91dcf731b2c121 (patch) | |
tree | 46cc0219028ab79b34d3a8c707920457120e939e /docs/development | |
parent | Add support for claiming multiple OTKs at once. (#15468) (diff) | |
download | synapse-eb6f8dc2152bab6e602a9617bd91dcf731b2c121.tar.xz |
Update development docs referencing outdated versions of sqlite we no longer support (#15498)
Diffstat (limited to 'docs/development')
-rw-r--r-- | docs/development/database_schema.md | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/docs/development/database_schema.md b/docs/development/database_schema.md index 29945c264e..e231be21dd 100644 --- a/docs/development/database_schema.md +++ b/docs/development/database_schema.md @@ -155,43 +155,11 @@ def run_upgrade( Boolean columns require special treatment, since SQLite treats booleans the same as integers. -There are three separate aspects to this: - - * Any new boolean column must be added to the `BOOLEAN_COLUMNS` list in +Any new boolean column must be added to the `BOOLEAN_COLUMNS` list in `synapse/_scripts/synapse_port_db.py`. This tells the port script to cast the integer value from SQLite to a boolean before writing the value to the postgres database. - * Before SQLite 3.23, `TRUE` and `FALSE` were not recognised as constants by - SQLite, and the `IS [NOT] TRUE`/`IS [NOT] FALSE` operators were not - supported. This makes it necessary to avoid using `TRUE` and `FALSE` - constants in SQL commands. - - For example, to insert a `TRUE` value into the database, write: - - ```python - txn.execute("INSERT INTO tbl(col) VALUES (?)", (True, )) - ``` - - * Default values for new boolean columns present a particular - difficulty. Generally it is best to create separate schema files for - Postgres and SQLite. For example: - - ```sql - # in 00delta.sql.postgres: - ALTER TABLE tbl ADD COLUMN col BOOLEAN DEFAULT FALSE; - ``` - - ```sql - # in 00delta.sql.sqlite: - ALTER TABLE tbl ADD COLUMN col BOOLEAN DEFAULT 0; - ``` - - Note that there is a particularly insidious failure mode here: the Postgres - flavour will be accepted by SQLite 3.22, but will give a column whose - default value is the **string** `"FALSE"` - which, when cast back to a boolean - in Python, evaluates to `True`. - ## `event_id` global uniqueness |