[mythtv] cvs.sql
Chris Palmer
mythtv at zencow.com
Sun Mar 30 16:13:00 EST 2003
So, I'm trying to reorganize cvs.sql so that it can run
straight thru without errors on anyone's system until it
gets to something that it doesn't need to do, such as
trying to add a new field that already exists.
It seems the best way for this to happen is to group the
types of changes to the database in the following sequence.
1. CREATE TABLE IF NOT EXISTS
so that all the tables exist first. all entries in
this section can be in any order.
2. ALTER TABLE MODIFY
so column definitions are up-to-date. all entries in
this section can be in any order.
3. ALTER TABLE ADD COLUMN
add columns that don't exist. all entries in this
section MUST be in order from most recent to oldest,
so that execution continues thru all entries until
getting to an item that has already exists.
?. ALTER TABLE DROP/ADD INDEX
rebuild indexes as needed. the position of these could
vary, since they depend on certain columns existing that
might not exist until after an ADD COLUMN. generally,
I'd put any that are not dependent on new coluns between
sections 1 and 2 above.
?. REPLACE INTO and any other command to change content
There are only 2 such statements in the current cvs.sql
file. I'm not sure what to do with them. Suggestions?
I noticed that I didn't actually have either of these in
my database, since it comes after an ADD COLUMN that I
already had when I created my 0.8 database, and execution
of the sql never got that far. Though, some people may have
different values for these in their tables and don't want
them changed every time they update with the cvs.sql file.
One thing I will look at is comparing the release 0.8 mc.sql
file against the cvs.diff and current mc.sql files, so that
there aren't any things in the cvs.diff that aren't needed
from before the 0.8 release.
Since I'm only just getting into these files for the first
time, input is welcome. Otherwise, I'll just structure things
so that as much of the cvs.sql file can be run before it hits
an error to make it stop (which I thought was the elegant plan
for this file). I'll keep the order of all ADD COLUMN statements
since I'm assuming they were added with most recent changes at
the top.
If it was always intended that cvs.sql be run with the -f
parameter (ignore errors and keep going til the end), then
I'll abort this quest and let my current patch submission
stand as-is.
-Chris
More information about the mythtv-dev
mailing list