Skip to content

Commit

Permalink
Delete/recreate recording extender tables for consistency.
Browse files Browse the repository at this point in the history
There were a couple of changes to the format of the recording extender
tables to force the use of a MYISAM database.

Fixes #480.

(cherry picked from commit 8d08c75)
  • Loading branch information
linuxdude42 committed Feb 16, 2022
1 parent 50b019d commit c2ac97c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
2 changes: 1 addition & 1 deletion mythtv/bindings/perl/MythTV.pm
Expand Up @@ -116,7 +116,7 @@ package MythTV;
# schema version supported in the main code. We need to check that the schema
# version in the database is as expected by the bindings, which are expected
# to be kept in sync with the main code.
our $SCHEMA_VERSION = "1375";
our $SCHEMA_VERSION = "1376";

# NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
# the number of items in a ProgramInfo QStringList group used by
Expand Down
2 changes: 1 addition & 1 deletion mythtv/bindings/python/MythTV/static.py
Expand Up @@ -5,7 +5,7 @@
"""

OWN_VERSION = (32,0,-1,0)
SCHEMA_VERSION = 1375
SCHEMA_VERSION = 1376
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1025
PROTO_VERSION = '91'
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythversion.h
Expand Up @@ -74,7 +74,7 @@
* mythtv/bindings/php/MythBackend.php
*/

#define MYTH_DATABASE_VERSION "1375"
#define MYTH_DATABASE_VERSION "1376"

MBASE_PUBLIC const char *GetMythSourceVersion();
MBASE_PUBLIC const char *GetMythSourcePath();
Expand Down
37 changes: 30 additions & 7 deletions mythtv/libs/libmythtv/dbcheck.cpp
Expand Up @@ -3859,13 +3859,10 @@ static bool doUpgradeTVDatabaseSchema(void)

if (dbver == "1371")
{
// Create the new tables first.
DBUpdates updates = getRecordingExtenderDbInfo(1);
if (!performUpdateSeries("MythtTV", updates))
return false;
// Recording extender tables are now created later.

// If that worked, modify existing tables.
updates = getRecordingExtenderDbInfo(0);
DBUpdates updates = getRecordingExtenderDbInfo(0);
if (!performActualUpdate("MythTV", "DBSchemaVer",
updates, "1372", dbver))
return false;
Expand Down Expand Up @@ -3901,11 +3898,30 @@ static bool doUpgradeTVDatabaseSchema(void)

if (dbver == "1374")
{
// Recording extender tables are now created later.
DBUpdates updates {};
if (!performActualUpdate("MythTV", "DBSchemaVer",
updates, "1375", dbver))
return false;
}

if (dbver == "1375")
{
// Delete any existing recording extender tables.
DBUpdates updates = getRecordingExtenderDbInfo(-1);
if (!performUpdateSeries("MythtTV", updates))
return false;

// Now (re)create them.
updates = getRecordingExtenderDbInfo(1);
if (!performUpdateSeries("MythtTV", updates))
return false;

// Add new tv listing name ->api name mappings for college
// basketball.
DBUpdates updates = getRecordingExtenderDbInfo(2);
updates = getRecordingExtenderDbInfo(2);
if (!performActualUpdate("MythTV", "DBSchemaVer",
updates, "1375", dbver))
updates, "1376", dbver))
return false;
}

Expand Down Expand Up @@ -5262,6 +5278,13 @@ DBUpdates getRecordingExtenderDbInfo (int version)
{
switch (version)
{
case -1:
return {
R"(DROP TABLE IF EXISTS sportscleanup;)",
R"(DROP TABLE IF EXISTS sportslisting;)",
R"(DROP TABLE IF EXISTS sportsapi;)",
};

case 0:
return {
R"(ALTER TABLE record ADD COLUMN autoextend
Expand Down

0 comments on commit c2ac97c

Please sign in to comment.