6 Database management system migration
Joe Groocock edited this page 2020-12-27 10:54:31 +00:00

New in version 0.3.0

The bridge includes a simple script for migrating between database management systems. It simply reads the data from one database and inserts it into another database

The script is located in mautrix_telegram/scripts/dbms_migrate. It can be ran using

$ python -m mautrix_telegram.scripts.dbms_migrate -f <source db> -t <target db>

Both <source db> and <target db> are full database URLs, e.g. sqlite:///mautrix-telegram.db and postgres://user:password@localhost/mautrixtelegram

Steps:

  1. Stop the bridge
  2. Update the database URI in the config
  3. Initiailize the new database with alembic upgrade head (for Docker you should cd /opt/mautrix-telegram/ and you may need to alembic -x config=/path/to/config.yaml upgrade head)
  4. Run the database migration script
  5. Start the bridge again