upgrade from 1.8 error

Bug #1288490 reported by Robert Lyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Robert Lyon

Bug Description

when I upgrade from 1.8_STABLE to 1.9dev I get this error:

 Could not execute command: ALTER TABLE usr_custom_layout ADD CONSTRAINT usrcustlayo_gro_fk FOREIGN KEY (`group`) REFERENCES `group` (id)
Call stack (most recent first):

    execute_sql("ALTER TABLE usr_custom_layout ADD CONSTRAINT usrcu...") at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/dml.php:1388
    execute_sql_arr(array(size 1), true, true) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/ddl.php:1210
    add_key(object(XMLDBTable), object(XMLDBKey)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/db/upgrade.php:2937
    xmldb_core_upgrade("2013101408") at /home/robertl/htdocs/mahara-devel/mahara/htdocs/lib/upgrade.php:295
    upgrade_core(object(stdClass)) at /home/robertl/htdocs/mahara-devel/mahara/htdocs/admin/upgrade.json.php:78

This is because a fix 09b2f5ba730d4d03950c713c1baaf1cb3174cde2 was added to master and also backported to 1.8

The version in master needs to check if foreign keys already exist or not.

Tags: regression
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/3080

Revision history for this message
Robert Lyon (robertl-9) wrote :

Ideally, now that the htdocs/lib/db/upgrade.php file is getting quite long it would be neater if we could split it up into versions

so have:
...
htdocs/lib/db/upgrade/1_7.php
htdocs/lib/db/upgrade/1_8.php
htdocs/lib/db/upgrade/1_9.php
...

we could possibly get it so that if something needs to be backported from 1_9 to 1_8 we only need to add the code change once somehow. [ I've not worked out how yet :) ]

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Whoops, my bad. I neglected the advice on this page: https://wiki.mahara.org/index.php/Developer_Area/Version_Numbering_Policy#Version_bumps_and_database_upgrades

"If you are pushing the same database upgrade to both master and to one or more stable branches ... you must ensure that your upgrade will not fail, (and will have no effect) when it is run a second time, because it will be run when users do their stable upgrade, and again when the next major upgrade comes out."

Revision history for this message
Aaron Wells (u-aaronw) wrote :
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/3080
Committed: http://gitorious.org/mahara/mahara/commit/4da1f28a30425771103be0d2c557931104461704
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 4da1f28a30425771103be0d2c557931104461704
Author: Robert Lyon <email address hidden>
Date: Thu Mar 6 13:32:56 2014 +1300

Failure on upgrade from 1.8 to 1.9 (Bug #1288490)

Don't run the usr_custom_layout upgrade patch if it was run before.
We check for the presence of the usr_custom_layout.group column to
see whether the patch has been run (or the instance was installed
with the fixes already in place).

Change-Id: I3adfd13ef622edc0c18de630869bd2a46700bbfb
Signed-off-by: Robert Lyon <email address hidden>

Aaron Wells (u-aaronw)
tags: added: regression
Changed in mahara:
status: Confirmed → Fix Committed
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.