Skip to content

Commit b4554fa

Browse files
committed
Delete duplicate recording rules before adding unique index.
Commit af5836e added a unique index to the record table to prevent the creation of duplicate recording rules, primarly from the internal web interface or mythweb. However, some users had already created duplicate rules which caused the index creation to fail. This commit changes the update to delete the duplicate rules before creating the index.
1 parent 92bf123 commit b4554fa

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mythtv/libs/libmythtv/dbcheck.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2728,6 +2728,13 @@ NULL
27282728
if (dbver == "1327")
27292729
{
27302730
const char *updates[] = {
2731+
"DELETE r1 FROM record r1, record r2 "
2732+
" WHERE r1.chanid = r2.chanid AND "
2733+
" r1.starttime = r2.starttime AND "
2734+
" r1.startdate = r2.startdate AND "
2735+
" r1.title = r2.title AND "
2736+
" r1.type = r2.type AND "
2737+
" r1.recordid > r2.recordid",
27312738
"ALTER TABLE record DROP INDEX chanid",
27322739
"ALTER TABLE record ADD UNIQUE INDEX "
27332740
" (chanid, starttime, startdate, title, type)",

0 commit comments

Comments
 (0)