Make matrix-registration use Postgres by default

Now that 0.7.2 is out, the Docker image supports Postgres
and we can do the (SQLite -> Postgres) migration.

I've also found out that we needed to fix up the `tokens.ex_date` column
data type a bit to prevent matrix-registration from raising exceptions
when comparing `datetime.now()` with `ex_date` coming from the database.

Example:

> File "/usr/local/lib/python3.8/site-packages/matrix_registration/tokens.py", line 58, in valid
> expired = self.ex_date < datetime.now()
> TypeError: can't compare offset-naive and offset-aware datetimes
This commit is contained in:
Slavi Pantaleev
2020-12-15 23:19:56 +02:00
parent 1bd5c240e5
commit a197968b7f
4 changed files with 7 additions and 11 deletions

View File

@ -18,6 +18,11 @@
engine_variable_name: 'matrix_registration_database_engine'
engine_old: 'sqlite'
systemd_services_to_stop: ['matrix-registration.service']
# pgloader makes `ex_date` of type `TIMESTAMP WITH TIMEZONE`,
# which makes matrix-registration choke on it later on when comparing dates.
additional_psql_statements_list:
- ALTER TABLE tokens ALTER COLUMN ex_date TYPE TIMESTAMP WITHOUT TIME ZONE;
additional_psql_statements_db_name: "{{ matrix_registration_database_db_name }}"
- import_tasks: "roles/matrix-postgres/tasks/util/migrate_db_to_postgres.yml"