Ticket #2040: mythplugins-mythvideo-initialize_categoryid-dbcheck.patch

File mythplugins-mythvideo-initialize_categoryid-dbcheck.patch, 862 bytes (added by sphery <mtdean@…>, 15 years ago)

Patch to "fix" invalid category ID's in the metadata table

  • mythvideo/mythvideo/dbcheck.cpp

     
    88#include "mythtv/mythcontext.h"
    99#include "mythtv/mythdbcon.h"
    1010
    11 const QString currentDatabaseVersion = "1008";
     11const QString currentDatabaseVersion = "1009";
    1212
    1313static void UpdateDBVersionNumber(const QString &newnumber)
    1414{
     
    215215
    216216        performActualUpdate(updates, "1008", dbver);
    217217    }
     218    if (dbver == "1008")
     219    {
     220        const QString updates[] = {
     221"UPDATE videometadata "
     222"LEFT JOIN videocategory ON (videometadata.category = videocategory.intid) "
     223"SET videometadata.category = 0 "
     224"WHERE videocategory.intid IS NULL;",
     225""
     226};
    218227
     228        performActualUpdate(updates, "1009", dbver);
     229    }
     230
    219231}