Skip to content

Commit

Permalink
Add schema update in preparation for new-logging
Browse files Browse the repository at this point in the history
The new-logging branch will require a new logging table in the database.  This
patch puts that in so we can merge easier in the near future.

Signed-off-by: Gavin Hurlbut <ghurlbut@mythtv.org>
  • Loading branch information
sphery authored and Beirdo committed Jun 1, 2011
1 parent 438ff81 commit f4827b1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mythtv/bindings/perl/MythTV.pm
Expand Up @@ -114,7 +114,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 = "1275";
our $SCHEMA_VERSION = "1276";

# 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 = (0,25,-1,2)
SCHEMA_VERSION = 1275
SCHEMA_VERSION = 1276
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1018
PROTO_VERSION = '66'
Expand Down
26 changes: 25 additions & 1 deletion mythtv/libs/libmythtv/dbcheck.cpp
Expand Up @@ -21,7 +21,7 @@ using namespace std;
mythtv/bindings/perl/MythTV.pm
*/
/// This is the DB schema version expected by the running MythTV instance.
const QString currentDatabaseVersion = "1275";
const QString currentDatabaseVersion = "1276";

static bool UpdateDBVersionNumber(const QString &newnumber, QString &dbver);
static bool performActualUpdate(
Expand Down Expand Up @@ -5693,6 +5693,30 @@ NULL
return false;
}

if (dbver == "1275")
{
const char *updates[] = {
"DROP TABLE IF EXISTS `logging`;",
"CREATE TABLE `logging` ( "
" `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, "
" `host` varchar(64) NOT NULL, "
" `application` varchar(64) NOT NULL, "
" `pid` int(11) NOT NULL, "
" `thread` varchar(64) NOT NULL, "
" `msgtime` datetime NOT NULL, "
" `level` int(11) NOT NULL, "
" `message` varchar(2048) NOT NULL, "
" PRIMARY KEY (`id`), "
" KEY `host` (`host`,`application`,`pid`,`msgtime`), "
" KEY `msgtime` (`msgtime`), "
" KEY `level` (`level`) "
") ENGINE=MyISAM DEFAULT CHARSET=utf8; ",
NULL
};
if (!performActualUpdate(updates, "1276", dbver))
return false;
}

return true;
}

Expand Down

0 comments on commit f4827b1

Please sign in to comment.