From 0d55f880751f695f5e89113d8a326af640358933 Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Wed, 26 Apr 2023 15:52:12 -0700 Subject: [PATCH 1/4] update docs referencing versions of sqlite we no longer support --- docs/development/database_schema.md | 34 +---------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/docs/development/database_schema.md b/docs/development/database_schema.md index 29945c264ee8..e231be21ddd2 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 From fe86db589afaee59b2492da8768a27d2194bec2b Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Wed, 26 Apr 2023 15:57:24 -0700 Subject: [PATCH 2/4] newsfragment --- changelog.d/15498.docs | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/15498.docs diff --git a/changelog.d/15498.docs b/changelog.d/15498.docs new file mode 100644 index 000000000000..ff8fa4becc40 --- /dev/null +++ b/changelog.d/15498.docs @@ -0,0 +1 @@ +Update development docs referencing versions of sqlite we no longer support. From 4710b40b38232454acd96b24815909d00c372447 Mon Sep 17 00:00:00 2001 From: "H. Shay" Date: Wed, 26 Apr 2023 16:02:04 -0700 Subject: [PATCH 3/4] .docs -> .doc --- changelog.d/{15498.docs => 15498.doc} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/{15498.docs => 15498.doc} (100%) diff --git a/changelog.d/15498.docs b/changelog.d/15498.doc similarity index 100% rename from changelog.d/15498.docs rename to changelog.d/15498.doc From e93b15bf909a33283c6f9e681221894008a0ec1d Mon Sep 17 00:00:00 2001 From: Shay Date: Fri, 28 Apr 2023 10:02:30 -0700 Subject: [PATCH 4/4] Update changelog.d/15498.doc Co-authored-by: reivilibre --- changelog.d/15498.doc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/15498.doc b/changelog.d/15498.doc index ff8fa4becc40..78715b8a3eb6 100644 --- a/changelog.d/15498.doc +++ b/changelog.d/15498.doc @@ -1 +1 @@ -Update development docs referencing versions of sqlite we no longer support. +Update outdated development docs that mention restrictions in versions of SQLite that we no longer support.