From: Sam H. <sa...@uo...> - 2006-08-03 21:28:53
|
On Aug 3, 2006, at 4:49 PM, Michael Gage wrote: > I think this feature should be the highest priority for your time. > A beginning stub for database update will be useful -- it may not > be full featured, but that's ok as long as the stub is moving in > the right direction. Ok, I'll get to work on this. I think I was unclear in my original notes -- wwdb_check can *already* do simple things like adding tables/columns/indexes, changing column types, etc. It does this by comparing the state of the database (using "SHOW TABLES" and "DESCRIBE") to the data in the WW Record classes. With respect to database versioning, it currently just makes sure that the dbupgrade table exists and the db_version entry is set correctly. What I'll be working on is adding a framework to that script to allow it to execute arbitrary Perl or SQL code to affect more complicated upgrades. > On Aug 3, 2006, at 2:05 PM, Sam Hathaway wrote: > >> -- Automatic Database Update -- >> >> wwdb_check will do simple things like adding tables/columns/indexes, >> changing >> column types, and the like. this is sufficient for gavin's current >> changes. >> >> eventually, we need a real database versioning system for more >> complicated >> changes -- filling default values, normalization, and the like -- but >> we don't >> technically have to have this mechanism in place right now. >> >> we just need to ensure that the state of 2.3.0 databases is: >> - all tables/columns/indexes up-to-date and using the correct types >> - dbupgrade table exists >> - db_version=0 in dbupgrade table >> >> (i'm also starting to think that the database upgrading should >> happend offline, >> in a command-line script.) > This is ok with with me, but I'd like it to be something that is > checked > when the server starts up or restarts (there is an Apache hook for > that which might > be the right thing to use.) We do something like this for checking > global.conf > and for that matter it wouldn't hurt to run a version of the > check_modules script. > I really like the behavior of moodle which is quite good about > insuring database > updates when ever an update of the system takes place, but we might > not be able to achieve that all in one go. I'm initially developing this stuff in wwdb_check, but eventually I'll put it into a library and we can call it from web code. Instead of doing this the way we did hashDatabaseOK, which ran on every request, we should probably call it from the code in webwork.apache- config, which gets executed at server startup time. The check_modules.pl script could similarly be rolled into a library and called from webwork.apache-config. -sam |