2018-08-08 09:07:02 +02:00
# Importing an existing SQLite database from another installation (optional)
2019-04-23 09:20:56 +02:00
Run this if you'd like to import your database from a previous default installation of Synapse.
2019-01-01 14:37:57 +01:00
(don't forget to import your `media_store` files as well - see [the importing-media-store guide ](importing-media-store.md )).
2018-08-08 09:07:02 +02:00
2019-04-23 09:20:56 +02:00
While this playbook always sets up PostgreSQL, by default a Synapse installation would run
2018-08-08 09:07:02 +02:00
using an SQLite database.
2019-04-23 09:20:56 +02:00
If you have such a Synapse setup and wish to migrate it here (and over to PostgreSQL), this command is for you.
2018-08-08 09:07:02 +02:00
2019-01-01 14:16:13 +01:00
## Prerequisites
2018-08-08 09:07:02 +02:00
2019-01-01 14:35:33 +01:00
Before doing the actual import, **you need to upload your SQLite database file to the server** (any path is okay).
2019-01-01 14:16:13 +01:00
## Importing
Run this command (make sure to replace `<server-path-to-homeserver.db>` with a file path on your server):
ansible-playbook -i inventory/hosts setup.yml --extra-vars='server_path_homeserver_db=< server-path-to-homeserver.db > ' --tags=import-sqlite-db
2020-10-07 08:06:59 +02:00
**Notes**:
- `<server-path-to-homeserver.db>` must be a file path to a `homeserver.db` **file on the server** (not on your local machine!).
- if the SQLite database is from an older version of Synapse, the **importing procedure may run migrations on it to bring it up to date** . That is, your SQLite database file may get modified and become unusable with your older Synapse version. Keeping a copy of the original is probably wise.