From 9b4aff58c7a2bd706daa9955009c412eaa57e05f Mon Sep 17 00:00:00 2001 From: Anatoly Sablin Date: Thu, 30 Jan 2020 23:17:01 +0300 Subject: [PATCH] Add migration documentation. --- docs/configure.md | 2 ++ docs/migration-to-postgresql.md | 41 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 docs/migration-to-postgresql.md diff --git a/docs/configure.md b/docs/configure.md index decd0e6..33bcdd7 100644 --- a/docs/configure.md +++ b/docs/configure.md @@ -76,6 +76,8 @@ storage: username: ma1sd password: secret_password ``` +See [the migration instruction](migration-to-postgresql.md) from sqlite to postgresql + ## Logging ```yaml diff --git a/docs/migration-to-postgresql.md b/docs/migration-to-postgresql.md new file mode 100644 index 0000000..6b569c5 --- /dev/null +++ b/docs/migration-to-postgresql.md @@ -0,0 +1,41 @@ +# Migration from sqlite to postgresql + +Starting from the version 2.3.0 ma1sd support postgresql for internal storage in addition to sqlite (parameters `storage.backend`). + +#### Migration steps + +1. create the postgresql database and user for ma1sd storage +2. create a backup for sqlite storage (default location: /var/lib/ma1sd/store.db) +3. migrate data from sqlite to postgresql +4. change ma1sd configuration to use the postgresql + +For data migration is it possible to use https://pgloader.io tool. + +Example of the migration command: +```shell script +pgloader --with "quote identifiers" /path/to/store.db pgsql://ma1sd_user:ma1sd_password@host:port/database +``` +or (short version for database on localhost) +```shell script +pgloader --with "quote identifiers" /path/to/store.db pgsql://ma1sd_user:ma1sd_password@localhost/ma1sd +``` + +An option `--with "quote identifies"` used to create case sensitive tables. +ma1sd_user - postgresql user for ma1sd. +ma1sd_password - password of the postgresql user. +host - postgresql host +post - database port (default 5432) +database - database name. + + +Configuration example for postgresql storage: +```yaml +storage: + backend: postgresql + provider: + postgresql: + database: '//localhost/ma1sd' # or full variant //192.168.1.100:5432/ma1sd_database + username: 'ma1sd_user' + password: 'ma1sd_password' +``` +