| 1 | Migrating User Data |
| 2 | =================== |
| 3 | RSS Guard automatically migrates all your user data if you upgrade to a newer minor version, for example if you update from `3.7.5` to `3.9.1`. |
| 4 | |
| 5 | If you decide to upgrade to a new major version, for example from `3.x.x` to `4.x.x`, then existing user data cannot be used. Major versions declared as non-backwards compatible, so such data transition is not supported. |
| 6 | |
| 7 | ## Migrating user data from `3.9.2` to `4.x.x` |
| 8 | ```{danger} |
| 9 | Only proceed if you consider yourself a SQL power user, and you know what you are doing! |
| 10 | |
| 11 | Make sure that last RSS Guard `3.x.x` version you used with your data was the latest `3.9.2`. |
| 12 | ``` |
| 13 | |
| 14 | Here is a short DIY manual on how to manually update your `database.db` file to `4.x.x` format. Similar approach can be taken if you use **MariaDB** database backend. |
| 15 | |
| 16 | Here are SQLs for [old schema](https://github.com/martinrotter/rssguard/blob/3.9.2/resources/sql/db_init_sqlite.sql) and [new schema](https://github.com/martinrotter/rssguard/blob/4.0.0/resources/sql/db_init_sqlite.sql). |
| 17 | |
| 18 | ## Converting `*Accounts` tables |
| 19 | In `3.x.x` each plugin/account type had its own table where it kept your login usernames, service URLs etc. In `4.x.x` all plugins share one table `Accounts` and place account-specific data into `custom_data` column. You simply can take all rows from any `*Accounts` table (for example `TtRssAccounts`) and insert them into `Accounts`, keeping all columns their default values, except of `type`, which must have one of these values: |
| 20 | * `std-rss` - For standard list of RSS/ATOM feeds |
| 21 | * `tt-rss` - For Tiny Tiny RSS |
| 22 | * `owncloud` - For Nextcloud News |
| 23 | * `greader` - For all Google Reader API services, including Inoreader |
| 24 | * `feedly` - For Feedly |
| 25 | * `gmail` - For Gmail |
| 26 | |
| 27 | Then you need to go to **Edit** dialog of your account in RSS Guard (once you complete this migration guide) and check for all missing login information etc. |
| 28 | |
| 29 | Once you add the row to the `Accounts` table, it will be assigned a unique integer `id` value, which is used as a foreign key in other DB tables via `account_id` column. |
| 30 | |
| 31 | ## Converting `Feeds` table |
| 32 | There are some changes in `Feeds` table: |
| 33 | * `url` column is renamed to `source` |
| 34 | * `source_type`, `post_process`, `encoding`, `type`, `protected`, `username`, `password` columns are removed, and their data is now stored in a JSON-serialized form in a new column `custom_data`. Here is an example of a `custom_data` value: |
| 35 | ```json |
| 36 | { |
| 37 | "encoding": "UTF-8", |
| 38 | "password": "AwUujeO2efOgYpX3g1/zoOTp9JULcLTZzwfY", |
| 39 | "post_process": "", |
| 40 | "protected": false, |
| 41 | "source_type": 0, |
| 42 | "type": 3, |
| 43 | "username": "" |
| 44 | } |
| 45 | ``` |
| 46 | |
| 47 | Pay attention to `account_id` column as this column is the ID of your account as stated in the above section. |
| 48 | |
| 49 | ## Converting `Messages` table |
| 50 | Columns were reordered and other than that new column `score` with sane default value was added. Therefore, you can simply copy your data in a column-to-column mode. |
| 51 | |
| 52 | Pay attention to `account_id` column as this column is the ID of your account as stated in the above section. |
| 53 | |
| 54 | ## Other tables |
| 55 | Other tables like `Labels` or `MessageFilters` are unchanged between these two major RSS Guard versions. But you might need to adjust `account_id` to match DB ID of your account. |