aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Sommerfeld <kai.sommerfeld@gmx.com>2021-04-19 09:19:18 +0200
committerGitHub <noreply@github.com>2021-04-19 09:19:18 +0200
commit9e055a9ec1a8f116c9a06999c526a157cea64894 (patch)
treee74febcd5e07723e04f7ec6ad911cb4125fca184
parent2726f0c3ee607752ff1f5f662ab50e33b7f75da7 (diff)
parentfbaf52a4dc5dedaeead1edfd18e00d1c91e61c1e (diff)
Merge pull request #19596 from howie-f/v19-tvdbmysql
[bp][pvr] fix: modify db field to unsigned bigint for mysql
-rw-r--r--xbmc/pvr/PVRDatabase.cpp43
-rw-r--r--xbmc/pvr/PVRDatabase.h2
2 files changed, 34 insertions, 11 deletions
diff --git a/xbmc/pvr/PVRDatabase.cpp b/xbmc/pvr/PVRDatabase.cpp
index 741a16b760..0975c2472f 100644
--- a/xbmc/pvr/PVRDatabase.cpp
+++ b/xbmc/pvr/PVRDatabase.cpp
@@ -34,6 +34,8 @@ using namespace PVR;
namespace
{
+// clang-format off
+
static const std::string sqlCreateTimersTable =
"CREATE TABLE timers ("
"iClientIndex integer primary key, "
@@ -61,6 +63,20 @@ namespace
"iMaxRecordings integer,"
"iRecordingGroup integer"
")";
+
+ static const std::string sqlCreateChannelGroupsTable =
+ "CREATE TABLE channelgroups ("
+ "idGroup integer primary key,"
+ "bIsRadio bool, "
+ "iGroupType integer, "
+ "sName varchar(64), "
+ "iLastWatched integer, "
+ "bIsHidden bool, "
+ "iPosition integer, "
+ "iLastOpened bigint unsigned"
+ ")";
+
+// clang-format on
} // unnamed namespace
bool CPVRDatabase::Open()
@@ -114,16 +130,7 @@ void CPVRDatabase::CreateTables()
);
CLog::LogFC(LOGDEBUG, LOGPVR, "Creating table 'channelgroups'");
- m_pDS->exec("CREATE TABLE channelgroups ("
- "idGroup integer primary key,"
- "bIsRadio bool, "
- "iGroupType integer, "
- "sName varchar(64), "
- "iLastWatched integer, "
- "bIsHidden bool, "
- "iPosition integer, "
- "iLastOpened integer"
- ")");
+ m_pDS->exec(sqlCreateChannelGroupsTable);
CLog::LogFC(LOGDEBUG, LOGPVR, "Creating table 'map_channelgroups_channels'");
m_pDS->exec(
@@ -229,6 +236,22 @@ void CPVRDatabase::UpdateTables(int iVersion)
if (iVersion < 37)
m_pDS->exec("ALTER TABLE channelgroups ADD iLastOpened integer");
+
+ if (iVersion < 38)
+ {
+ m_pDS->exec("ALTER TABLE channelgroups "
+ "RENAME TO channelgroups_old");
+
+ m_pDS->exec(sqlCreateChannelGroupsTable);
+
+ m_pDS->exec(
+ "INSERT INTO channelgroups (bIsRadio, iGroupType, sName, iLastWatched, bIsHidden, "
+ "iPosition, iLastOpened) "
+ "SELECT bIsRadio, iGroupType, sName, iLastWatched, bIsHidden, iPosition, iLastOpened "
+ "FROM channelgroups_old");
+
+ m_pDS->exec("DROP TABLE channelgroups_old");
+ }
}
/********** Client methods **********/
diff --git a/xbmc/pvr/PVRDatabase.h b/xbmc/pvr/PVRDatabase.h
index dbbb1db09c..7615dd2c67 100644
--- a/xbmc/pvr/PVRDatabase.h
+++ b/xbmc/pvr/PVRDatabase.h
@@ -61,7 +61,7 @@ namespace PVR
* @brief Get the minimal database version that is required to operate correctly.
* @return The minimal database version.
*/
- int GetSchemaVersion() const override { return 37; }
+ int GetSchemaVersion() const override { return 38; }
/*!
* @brief Get the default sqlite database filename.