[mythtv-users] Cleaning my DB?

Bill Bogstad bogstad at pobox.com
Fri May 28 21:12:43 UTC 2010

On Fri, May 28, 2010 at 1:33 PM, Mike Perkins
<mikep at randomtraveller.org.uk> wrote:
> Bill Bogstad wrote:
>> One issue that I have had with deleting tuners/video sources is that
>> all of my old recordings lose
>> their channel identification information.  (Admittedly this is a minor
>> aesthetic issue.) The recorded table still has a chanid, but the
>> channel table no longer has an entry for it.
> A good point, especially as those chanids may get reused for different
> channels as the providers shuffle things around. Perhaps the database ought
> to also be saving, for example, callsign. That's going to be (human)
> identifiable, and it potentially allows recordings to be remapped when
> chanids change.

It would seem to me that the problem is that chanid numbers appear to
be constructed from the sourceid and human readable channel numbers.
If chanids were just unique keys generated as new channels needed to
be created, there would be no worries about potential conflicts with
future channels (or even new incarnations of the same "channel").
Rather then deleting all matching entries from the channel table when
a videosource is deleted, the sourceid field in the channel table
could be set to some special value which indicates that the source is
invalid.   Entries would only be removed from the channel table when
the sourceid was invalid and there were no recordings which still
pointed to that chanid.

OTOH, I don't know most of the details of the mythtv database schema
and its usage so maybe this wouldn't work.
If it could work though I think it would be preferable to not create
the problem to begin with rather then trying to fix it up after the

Bill Bogstad

More information about the mythtv-users mailing list