|
To clarify, the upgrade from 1.6/1.7 etc. works. The problem is the upgrade from 1.8 dev!
I still need help!!
I am now trying to drop the primary key before renaming each table (is this possible?), with code like: "" $tables = array('', '_members', '_groupings', '_courses_groups', '_courses_groupings', '_groupings_groups'); foreach ($tables as $t_name) { But this doesn't seem to work - I currently get this output (Adodb warning at the end): "" Sorry, groups tables created in Moodle 1.8 dev are being archived and renamed to 'groups_*_temp_18'! (postgres7): SELECT co.conname AS name, co.consrc AS description FROM pg_constraint co, pg_class cl WHERE co.conrelid = cl.oid AND co.contype = 'c' AND cl.relname = 'headmdl_groups' (postgres7): ALTER TABLE headmdl_groups_id_seq RENAME TO headmdl_groups_temp_18_id_seq ... Warning: pg_query() [function.pg-query]: Query failed: ERROR: relation "headmdl_grou_id_pk" already exists in /var/www/html/ndf42/head/lib/adodb/drivers/adodb-postgres7.inc.php on line 115 Fixed using version 4 of the patch.
This uses a new approach - the admin is given a 'Do you want to continue?' message, with yes/ no options - if they choose yes groups tables are dropped and recreated. (This gets round the issue that primary keys can't be dropped separately, and in Postgres, MySQL, etc. keys can't be renamed.) Fixed, committed. Tested on PostgreSQL - uses XMLDB so hopefully the same on other DBs.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
So this patch fixes the upgrade from 1.6/1.7, and the incremental upgrade of 1.8 dev by,
1. drops the foreign keys/indexes created by the previous 2007012200 upgrade (sorry Eloy!),
2. renames all the new 1.8 tables to 'groups_temp_18', etc.
3. recreates them using XMLDB.
4. transfers data, calling 'groups_db_upgrade_group'.
(3) goes wrong as the rename does not rename the primary keys - it complains that they already exist. I could drop the tables in (2), but admins won't like that!
Tested on PostgreSQL.