How to migrate your (mysql) persistence data to openHAB 2?

Since openHAB 2 is starting to get stable I am planning to switch soon. But I’m a litte wary since I only have a “production” openHAB 1.83 to switch from, so I want to do it right.

One of my biggest concerns is the data in the MySQL persistence store.
I see this as the most valuable part of my whole openHAB setup and want to continue to use it in openHAB 2.

In openHAB 1.x a table ItemX is created and all the records for an item are inserted in that table. And the itemname to table mapping is kept in the Items table. How does openHAB 2 does this? Since there are things which have one or more items.

Besides that when I switch I would like to restructure to the new naming convension.
Is it as simple as fixing the records in the Items table?

The same MySQL persistence service will be persisting your item states on OH2 as on OH1, so there is no change in that regard. If your items have the same meaning but different names in OH2, you could edit the Items table to refer to the new names and OH2 should continue to add rows to the correct tables. If you’re nervous about losing data, use mysqldump to create a .sql backup file of your database contents first.

1 Like

Tnx, that is good to know.
Making a backup is always a good idea yes.