[mythtv-users] Asking before upgrading the schema

Brad Templeton brad+myth at templetons.com
Wed Jul 5 01:42:41 UTC 2006


On Tue, Jul 04, 2006 at 10:44:20AM -0300, Greg Estabrooks wrote:
> > Is there some reason why Myth doesn't -ASK- first?  If someone
> > submitted a patch to make it ask, would it be accepted?
> 
>  Noone is going to "pre accept" code. Write it, submit it. If the
> code is clean, provides a useful function then it has a high chance of being
> accepted. The exact same rules that apply to all submitted patches.

The right approach is not a piece of code, but a coding methodology.

I would suggest:

a) That unless absolutely impossible, all database upgrades be backwards
compatible with older versions for some distance.    Actually, most of
the ones we see are.    What this means is that adding new tables is
no problem, adding new columns to tables must always have a default
value, and all sql operations must explicitly name all columns so they
are not bothered by added columns.   In addition, new code must handle,
for some time to come, finding the default value in a new column if a row
was created by older code.

b) Instead of just having a single DBSchemaVer integer, cap that value
and have a DBSchemaTags which is a long TEXT with an array of space
delimited keywords naming various db schema changes.  That would be put
into a hash table so code can test "Does the database support feature X?"
and can decide whether to command creation of feature X or not to use it.



Step b in particular makes it easier for people to do their own development
of features that use new database columns or tables while still being able
to update from the svn trunk the new database columns others have added. 
There's no easy way to do that now.



More information about the mythtv-users mailing list