[mythtv] handling database structural changes

Bruce Markey bjm at lvcm.com
Sat Jun 7 16:04:20 EDT 2003


Kirby Vandivort wrote:
> re: the changes that you've committed..  I've just recently started
> digging into the src, so I could be mistaken, but...

First, thanks for your suggestion. There has always been
a problem when an update is declared in the mythtv-commits
but not everyone sees the messages or remembers to check
to see if the files in database/ have been updated. I think
everyone liked the idea of checking a version. This is the
'10% of the work solves 90% of the problem' first step.

> it would probably be good to rename the 'dbschemaversion' var to
> something that specifies 'mythtv'.  The reason that I say this is
> because the other myth 'components' (music, video, etc) also create
> tables in mythconverg that could benefit from a version number.

It can easily be changed to a uniform naming when/if other
components use a version number. However, the MythTV schema
is used my libmyth and is therefore kind of a prerequisite
of all of the other components. I became aware of the
problem of other components while I was working on this
and so CheckDBVersion is only called by mythbackend for now.
Mythvideo sql files are Rev. 1.1, mythgame Rev 1.2, and
mythmusic are no higher than Rev. 1.5 so this hasn't been as
much of an issue for these components. Maybe Thor or John
will beat me to the punch if they want to use version numbers.

> However, I don't think we want mythvideo versions tied to a file in the
> mythtv cvs that contains the hardcoded version number (in other words,
> as it currently stands, everytime someone changes the mythvideo table,
> they will have to remember to go and change something in the mythtv cvs
> tree.)  Would be better for mythvideo to keep track of its own.  So, each
> component would have its own row in 'settings' that would tell it what
> version of the db IT was on.

You're right in that the question of how individual components
track their version numbers is more significant than the
specific name that appears in the settings table.

The mythtv schema has the settings table which is shared by
the other components. Others should at least check that the
DBSchemaVer is >0 or even >= the version for the most recent
release to be sure the shared schema is acceptable. However,
they do not need to require each MythTV change, they just
need to be above some minimum version. Next they could check
MythVideoDBVer, for example, and complain if there are updates
in mythvideo/videodb .

> Just my thoughts..

Thanks for your feedback. If you want to try automating
updates, CheckDBVersion is the place to be. You'll have current
schema number and the version the app requires. I was thinking
almost the exact same thing Ben suggested. Install the update
SQL files in the share directory then determine which file(s)
need to run to bring the schema up to date.

-- bjm





More information about the mythtv-dev mailing list