Ticket #3842: 3842-add-new-column-trunk-v2.patch
File 3842-add-new-column-trunk-v2.patch, 7.9 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/dbcheck.cpp
11 11 #include "datadirect.h" // for DataDirectProcessor::FixProgramIDs 12 12 13 13 /// This is the DB schema version expected by the running MythTV instance. 14 const QString currentDatabaseVersion = "1 199";14 const QString currentDatabaseVersion = "1200"; 15 15 16 16 static bool UpdateDBVersionNumber(const QString &newnumber); 17 17 static bool performActualUpdate(const QString updates[], QString version, … … 294 294 airing. If this is "0" it usually means that this is a brand new show 295 295 or a rebroadcast within the first two weeks. 296 296 297 'isnew' is a field that tells us if a listings source has marked this 298 program as a first showing of a program. 299 297 300 'programid' is the Tribune Media Service database record identifier 298 301 for each program description. In general, these start with a two 299 302 letter prefix, MV, EP, SP or SH that equate to the 'category_type'. … … 3247 3250 return false; 3248 3251 } 3249 3252 3253 if (dbver == "1199") 3254 { 3255 const QString updates[] = { 3256 "ALTER TABLE recorded ADD COLUMN isnew TINYINT(1) DEFAULT 0;", 3257 "ALTER TABLE recordedprogram ADD COLUMN isnew TINYINT(1) DEFAULT 0;", 3258 "ALTER TABLE program ADD COLUMN isnew TINYINT(1) DEFAULT 0;", 3259 "ALTER TABLE program ADD INDEX (isnew);", 3260 "" 3261 }; 3262 if (!performActualUpdate(updates, "1200", dbver)) 3263 return false; 3264 } 3265 3250 3266 //"ALTER TABLE cardinput DROP COLUMN preference;" in 0.22 3251 3267 //"ALTER TABLE channel DROP COLUMN atscsrcid;" in 0.22 3252 3268 //"ALTER TABLE recordedmarkup DROP COLUMN offset;" in 0.22 -
libs/libmythtv/datadirect.h
97 97 QString stationid; // 12 98 98 QDateTime time; 99 99 QTime duration; 100 bool repeat;101 100 bool isnew; 102 101 bool stereo; 103 102 bool subtitled; -
libs/libmythtv/datadirect.cpp
68 68 DataDirectSchedule::DataDirectSchedule() : 69 69 programid(""), stationid(""), 70 70 time(QDateTime()), duration(QTime()), 71 repeat(false),isnew(false),71 isnew(false), 72 72 stereo(false), subtitled(false), 73 73 hdtv(false), closecaptioned(false), 74 74 tvrating(""), … … 168 168 curr_schedule.duration = QTime(durstr.mid(2, 2).toInt(), 169 169 durstr.mid(5, 2).toInt(), 0, 0); 170 170 171 curr_schedule.repeat = (pxmlatts.value("repeat") == "true");172 171 curr_schedule.isnew = (pxmlatts.value("new") == "true"); 173 172 curr_schedule.stereo = (pxmlatts.value("stereo") == "true"); 174 173 curr_schedule.subtitled = (pxmlatts.value("subtitled") == "true"); … … 277 276 query.prepare( 278 277 "INSERT INTO dd_schedule " 279 278 " ( programid, stationid, scheduletime, " 280 " duration, is repeat,stereo, "279 " duration, isnew, stereo, " 281 280 " subtitled, hdtv, closecaptioned, " 282 281 " tvrating, partnumber, parttotal, " 283 " endtime , isnew) "282 " endtime ) " 284 283 "VALUES " 285 284 " (:PROGRAMID, :STATIONID, :TIME, " 286 " :DURATION, :IS REPEAT,:STEREO, "285 " :DURATION, :ISNEW, :STEREO, " 287 286 " :SUBTITLED, :HDTV, :CAPTIONED, " 288 287 " :TVRATING, :PARTNUMBER, :PARTTOTAL, " 289 " :ENDTIME , :ISNEW)");288 " :ENDTIME )"); 290 289 291 290 query.bindValue(":PROGRAMID", curr_schedule.programid); 292 291 query.bindValue(":STATIONID", curr_schedule.stationid); 293 292 query.bindValue(":TIME", curr_schedule.time); 294 293 query.bindValue(":DURATION", curr_schedule.duration); 295 query.bindValue(":ISREPEAT", curr_schedule.repeat);296 294 query.bindValue(":STEREO", curr_schedule.stereo); 297 295 query.bindValue(":SUBTITLED", curr_schedule.subtitled); 298 296 query.bindValue(":HDTV", curr_schedule.hdtv); … … 608 606 "INSERT INTO dd_v_program " 609 607 " ( chanid, starttime, endtime, " 610 608 " title, subtitle, description, " 611 " airdate, stars, previouslyshown, "609 " airdate, stars, isnew, " 612 610 " stereo, subtitled, hdtv, " 613 611 " closecaptioned, partnumber, parttotal, " 614 612 " seriesid, originalairdate, showtype, " … … 616 614 " tvrating, mpaarating, programid ) " 617 615 "SELECT chanid, scheduletime, endtime, " 618 616 " title, subtitle, description, " 619 " year, stars, is repeat,"617 " year, stars, isnew, " 620 618 " stereo, subtitled, hdtv, " 621 619 " closecaptioned, partnumber, parttotal, " 622 620 " seriesid, originalairdate, showtype, " … … 804 802 if (!query.exec("INSERT IGNORE INTO program (chanid, starttime, endtime, " 805 803 "title, subtitle, description, " 806 804 "showtype, category, category_type, " 807 "airdate, stars, previouslyshown, stereo, subtitled, "805 "airdate, stars, isnew, stereo, subtitled, " 808 806 "hdtv, closecaptioned, partnumber, parttotal, seriesid, " 809 807 "originalairdate, colorcode, syndicatedepisodenumber, " 810 808 "programid) " … … 813 811 "DATE_ADD(endtime, INTERVAL channel.tmoffset MINUTE), " 814 812 "title, subtitle, description, " 815 813 "showtype, dd_genre.class, category_type, " 816 "airdate, stars, previouslyshown, stereo, subtitled, "814 "airdate, stars, isnew, stereo, subtitled, " 817 815 "hdtv, closecaptioned, partnumber, parttotal, seriesid, " 818 816 "originalairdate, colorcode, syndicatedepisodenumber, " 819 817 "dd_v_program.programid FROM (dd_v_program, channel) " … … 1297 1295 dd_tables["dd_schedule"] = 1298 1296 "( programid char(40), stationid char(12), " 1299 1297 " scheduletime datetime, duration time, " 1300 " is repeat bool, stereo bool, "1298 " isnew tinyint, stereo bool, " 1301 1299 " subtitled bool, hdtv bool, " 1302 1300 " closecaptioned bool, tvrating char(5), " 1303 1301 " partnumber int, parttotal int, " 1304 " endtime datetime, isnew bool,"1302 " endtime datetime, " 1305 1303 "INDEX progidx (programid) )"; 1306 1304 1307 1305 dd_tables["dd_program"] = … … 1321 1319 " subtitle varchar(128), description text, " 1322 1320 " category varchar(64), category_type varchar(64), " 1323 1321 " airdate year, stars float unsigned, " 1324 " previouslyshown tinyint, isrepeat bool,"1322 " isnew tinyint, " 1325 1323 " stereo bool, subtitled bool, " 1326 1324 " hdtv bool, closecaptioned bool, " 1327 1325 " partnumber int, parttotal int, "