Kodi Community Forum

Full Version: Run new Kodi version against existing MySQL without database upgrade
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm looking to upgrade to the latest version of Kodi.  I use a shared mySQL database.  I would like to recreate my library as part of the process, without affecting my current setup.  Is there a way for me to run the new Kodi version and get it to just create a new blank database, rather than importing/upgrading my old database?

Thanks,
Jim
(2020-09-19, 21:05)mularj Wrote: [ -> ]Is there a way for me to run the new Kodi version and get it to just create a new blank database, rather than importing/upgrading my old database?
Yes, don't add the advancedsettings.xml tags that point to the MySQL databases. Kodi will then create the default local databases and use those.
(2020-09-19, 21:08)Karellen Wrote: [ -> ]
(2020-09-19, 21:05)mularj Wrote: [ -> ]Is there a way for me to run the new Kodi version and get it to just create a new blank database, rather than importing/upgrading my old database?
Yes, don't add the advancedsettings.xml tags that point to the MySQL databases. Kodi will then create the default local databases and use those.

While that would work, eventually I want to upgrade other nodes in my home to use the new database.  Creating it locally wouldn't really help.  To put it another way, i'm trying to create to parallel environments using different version that share the same mySQL server.

Thanks,
Jim
(2020-09-19, 21:25)mularj Wrote: [ -> ]
(2020-09-19, 21:08)Karellen Wrote: [ -> ]
(2020-09-19, 21:05)mularj Wrote: [ -> ]Is there a way for me to run the new Kodi version and get it to just create a new blank database, rather than importing/upgrading my old database?
Yes, don't add the advancedsettings.xml tags that point to the MySQL databases. Kodi will then create the default local databases and use those.

While that would work, eventually I want to upgrade other nodes in my home to use the new database.  Creating it locally wouldn't really help.  To put it another way, i'm trying to create to parallel environments using different version that share the same mySQL server.

Thanks,
Jim

I was hoping there was a command line switch or something.  Worst case I can drop the existing database, run the new version of Kodi against the mySQL server, then remount the old database.
(2020-09-19, 21:42)mularj Wrote: [ -> ]I was hoping there was a command line switch or something.  Worst case I can drop the existing database, run the new version of Kodi against the mySQL server, then remount the old database.

There is a reason for the version changes.  Often it is because new fields have been added to tables or views within the db.  The version of Kodi that corresponds to a specific db version will expect those fields/views to be available and if they are not, will at the very least throw out errors into the log.  Actual behaviour is probably undefined although for the most part, it's most likely that the SQL queries will fail and you just won't get any results in the GUI.  Matrix has had a couple of changes to the video db I think but has mainly had changes to the music db.  Current master is at MyMusic81 and MyVideos119.

Whilst an earlier version of Kodi could use those databases (extra stuff in there that will never be accessed), it doesn't work the other way around.  Master will expect that the new stuff exists and will at the very least register errors in the log along with not navigating properly and at the worst might crash.

A portable_mode (wiki) install, coupled with changes to your advancedsettings.xml might be a way to test things out without breaking the functionality of your current install(s).
(2020-09-19, 22:03)black_eagle Wrote: [ -> ]
(2020-09-19, 21:42)mularj Wrote: [ -> ]I was hoping there was a command line switch or something.  Worst case I can drop the existing database, run the new version of Kodi against the mySQL server, then remount the old database.

There is a reason for the version changes.  Often it is because new fields have been added to tables or views within the db.  The version of Kodi that corresponds to a specific db version will expect those fields/views to be available and if they are not, will at the very least throw out errors into the log.  Actual behaviour is probably undefined although for the most part, it's most likely that the SQL queries will fail and you just won't get any results in the GUI.  Matrix has had a couple of changes to the video db I think but has mainly had changes to the music db.  Current master is at MyMusic81 and MyVideos119.

Whilst an earlier version of Kodi could use those databases (extra stuff in there that will never be accessed), it doesn't work the other way around.  Master will expect that the new stuff exists and will at the very least register errors in the log along with not navigating properly and at the worst might crash.

A portable_mode (wiki) install, coupled with changes to your advancedsettings.xml might be a way to test things out without breaking the functionality of your current install(s).

Thanks.

Again, not looking to circumvent anything here.  I understand why the DB upgrade takes place. I just want to run a newer version of the software without the automatic upgrade of the existing shared database when it connects to mySQL.  Then I can start to configure everything from scratch and import my media paths from scratch. I'm on Kodi 14 still.  When I run Kodi 18 and it imports my existing database all kinds of bad things happen and there is no easy way to clean it up.  A fresh database seems to be the right path forward.  I think my idea of dropping the existing database just before running the new Kodi, forcing it to create a blank database at the latest version, and then remounting the old database is my only option.  Would be cool if there was a command line switch like /NoSharedDBUpgrade that would do this which is why i asked.  Seems easy enough.  Once the new database name exists any upgraded nodes that connect would just use to the new database version (myvideo119 or whatever).
 
Jim
(2020-09-19, 22:03)black_eagle Wrote: [ -> ]
(2020-09-19, 21:42)mularj Wrote: [ -> ]I was hoping there was a command line switch or something.  Worst case I can drop the existing database, run the new version of Kodi against the mySQL server, then remount the old database.

There is a reason for the version changes.  Often it is because new fields have been added to tables or views within the db.  The version of Kodi that corresponds to a specific db version will expect those fields/views to be available and if they are not, will at the very least throw out errors into the log.  Actual behaviour is probably undefined although for the most part, it's most likely that the SQL queries will fail and you just won't get any results in the GUI.  Matrix has had a couple of changes to the video db I think but has mainly had changes to the music db.  Current master is at MyMusic81 and MyVideos119.

Whilst an earlier version of Kodi could use those databases (extra stuff in there that will never be accessed), it doesn't work the other way around.  Master will expect that the new stuff exists and will at the very least register errors in the log along with not navigating properly and at the worst might crash.

A portable_mode (wiki) install, coupled with changes to your advancedsettings.xml might be a way to test things out without breaking the functionality of your current install(s).
I think I may see where the confusion exists here @black_eagle.  I'm not looking to run the new version of Kodi against an old database.  I understand why it needs to create a new database with updated schema and things like stored procedures and views.  I want all that without importing the media from the existing database (myVideos90), just because it finds that DB on the mySql server.  New MyVideos119 DB without bringing over my baggage.

Again, I think dropping the old DB, running the new Kodi against the mySQL server to create the blank DB, then re-mounting my Old DB is the only option.  A command line swithch on Kodi would make that a lot easier.  If it isn't an existing feature maybe something I will add to a feature request.

Thanks,
Jim
(2020-09-19, 23:18)mularj Wrote: [ -> ]
(2020-09-19, 22:03)black_eagle Wrote: [ -> ]
(2020-09-19, 21:42)mularj Wrote: [ -> ]I was hoping there was a command line switch or something.  Worst case I can drop the existing database, run the new version of Kodi against the mySQL server, then remount the old database.

There is a reason for the version changes.  Often it is because new fields have been added to tables or views within the db.  The version of Kodi that corresponds to a specific db version will expect those fields/views to be available and if they are not, will at the very least throw out errors into the log.  Actual behaviour is probably undefined although for the most part, it's most likely that the SQL queries will fail and you just won't get any results in the GUI.  Matrix has had a couple of changes to the video db I think but has mainly had changes to the music db.  Current master is at MyMusic81 and MyVideos119.

Whilst an earlier version of Kodi could use those databases (extra stuff in there that will never be accessed), it doesn't work the other way around.  Master will expect that the new stuff exists and will at the very least register errors in the log along with not navigating properly and at the worst might crash.

A portable_mode (wiki) install, coupled with changes to your advancedsettings.xml might be a way to test things out without breaking the functionality of your current install(s).
I think I may see where the confusion exists here @black_eagle.  I'm not looking to run the new version of Kodi against an old database.  I understand why it needs to create a new database with updated schema and things like stored procedures and views.  I want all that without importing the media from the existing database (myVideos90), just because it finds that DB on the mySql server.  New MyVideos119 DB without bringing over my baggage.

Again, I think dropping the old DB, running the new Kodi against the mySQL server to create the blank DB, then re-mounting my Old DB is the only option.  A command line swithch on Kodi would make that a lot easier.  If it isn't an existing feature maybe something I will add to a feature request.

Thanks,
Jim
Hey- does the Kodi team publish a SQL script to create a blank database for specific Kodi versions?  That would work too, if I created the DB schema in advance with the correct name (MyVideos119).
(2020-09-19, 23:22)mularj Wrote: [ -> ]Hey- does the Kodi team publish a SQL script to create a blank database for specific Kodi versions?  That would work too, if I created the DB schema in advance with the correct name (MyVideos119).

No. I guess your best bet is to backup your current db and then drop it.  Run v19 with it pointing to your MySQL server and it'll create the new databases for you.  Then re-create the db you dropped and import the backup into it.  Then you can have the original clients still using that db and a fresh empty db for v19.
Just change the name of it in your Leia advancedsettings.xml. Assuming you have the sql server set up right it will just use that name instead of the MyVideos. You can name your DB's anything you want. The only part of the DB name that Kodi cares about is the number, and it does that on it's own. Right now I'm running 3 separate DBs for video (one for each home on this piece of land) and a single music db that everyone shares. You can change that name. Once your migration is complete on all nodes to Leia and they are using the new DB dump the old ones if you choose.
Code:
cat ~/.kodi/userdata/advancedsettings.xml
<advancedsettings>
  <videodatabase>
    <type>mysql</type>
    <host>sql.mylan.home</host>
    <name>jygvideo</name>
    <port>3306</port>
    <user>kodi</user>
    <pass>kodi</pass>
  </videodatabase>
  <musicdatabase>
    <type>mysql</type>
    <host>sql.mylan.home</host>
    <name>ourmusic</name>
    <port>3306</port>
    <user>kodi</user>
    <pass>kodi</pass>
  </musicdatabase>
  <videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
  <loglevel>1</loglevel>
</advancedsettings>
Code:
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| familygnucash      |
| gstvideo116        |
| information_schema |
| jygvideo116        |
| momdadvideo116     |
| mysql              |
| mythconverg        |
| ourmusic72         |
| performance_schema |
+--------------------+
9 rows in set (0.00 sec)

Unless I'm just not getting what you are asking.
(2020-09-20, 23:10)jmgibson1981 Wrote: [ -> ]Just change the name of it in your Leia advancedsettings.xml. Assuming you have the sql server set up right it will just use that name instead of the MyVideos. You can name your DB's anything you want. The only part of the DB name that Kodi cares about is the number, and it does that on it's own. Right now I'm running 3 separate DBs for video (one for each home on this piece of land) and a single music db that everyone shares. You can change that name. Once your migration is complete on all nodes to Leia and they are using the new DB dump the old ones if you choose.
Code:
cat ~/.kodi/userdata/advancedsettings.xml
<advancedsettings>
  <videodatabase>
    <type>mysql</type>
    <host>sql.mylan.home</host>
    <name>jygvideo</name>
    <port>3306</port>
    <user>kodi</user>
    <pass>kodi</pass>
  </videodatabase>
  <musicdatabase>
    <type>mysql</type>
    <host>sql.mylan.home</host>
    <name>ourmusic</name>
    <port>3306</port>
    <user>kodi</user>
    <pass>kodi</pass>
  </musicdatabase>
  <videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
  <loglevel>1</loglevel>
</advancedsettings>
Code:
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| familygnucash      |
| gstvideo116        |
| information_schema |
| jygvideo116        |
| momdadvideo116     |
| mysql              |
| mythconverg        |
| ourmusic72         |
| performance_schema |
+--------------------+
9 rows in set (0.00 sec)

Unless I'm just not getting what you are asking.

You hit it on the nail perfectly.  That will work for my purposes.  Thank you.