Ok the problem here is in 16.10.0 there was a patch added (patch A) that
altered the artefact_file_mime_types table and set a new primary key on
a new id column - by first dropping the existing primary key based on
the key name.

Later there was another patch (patch B) that was added after patch A
that dropped the table and set a new primary key based on two columns.

Patch B was backported to earlier branches, eg 16.04.5

This meant if one now upgrades from 16.04.5 to 16.10.0 things will fail
as the code to drop the primary key is now wrong and so is ignored and
then tries to add a new primary key to the table, which is not allowed.

To stop this happening for subsequent 16.10 branch releases we need to
remove the upgrade part for (patch A) as it is not needed any more as
the upgrade for Patch B supersedes it.

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask 
on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1651011

Title:
  Issue upgrading Mahara site to 17.04dev

Status in Mahara:
  In Progress
Status in Mahara 16.10 series:
  In Progress

Bug description:
  This issue arose from bug #1647885. The upgrade fails because the
  primary key is incorrect in the table artefact_file_mime_types

  Robert sayd: Rather than dropping and re-creating the table, it would
  be better to truncate the table and change the primary key. That way,
  the table structure stays the same.

  To replicate:

  1. Install 16.04 and go through the regular setup steps.
  2. Upgrade to master
  Expected result: The upgrade completes. Actual result: Upgrade fails on 
artefact.file with the following error message, which can only be seen when you 
attempt to run the upgrade again:

  [DBG] 0e (artefact/file/db/upgrade.php:446) Drop the old primary key 
constraint and add new id column from/to the table artefact_file_mime_types
  [DBG] 0e (lib/dml.php:157) postgres8 error: [-1: ERROR:  multiple primary 
keys for table "artefact_file_mime_types" are not allowed] in adodb_throw(ALTER 
TABLE "artefact_file_mime_types"
                              DROP CONSTRAINT IF EXISTS 
"artefilemimetype_mim_pk",
                              ADD COLUMN id SERIAL PRIMARY KEY, )
  Command was: ALTER TABLE "artefact_file_mime_types"
                              DROP CONSTRAINT IF EXISTS 
"artefilemimetype_mim_pk",
                              ADD COLUMN id SERIAL PRIMARY KEY
  [WAR] 0e (lib/errors.php:859) Could not execute command: ALTER TABLE 
"artefact_file_mime_types"
                              DROP CONSTRAINT IF EXISTS 
"artefilemimetype_mim_pk",
                              ADD COLUMN id SERIAL PRIMARY KEY
  Call stack (most recent first):

      log_message(string(size 207), integer, true, true) at 
/home/kristina/code/mahara/htdocs/lib/errors.php:95
      log_warn(string(size 207)) at 
/home/kristina/code/mahara/htdocs/lib/errors.php:859
      SQLException->__construct(string(size 207)) at 
/home/kristina/code/mahara/htdocs/lib/dml.php:158
      execute_sql(string(size 180)) at 
/home/kristina/code/mahara/htdocs/artefact/file/db/upgrade.php:450
      xmldb_artefact_file_upgrade(string(size 10)) at 
/home/kristina/code/mahara/htdocs/lib/upgrade.php:423
      upgrade_plugin(object(stdClass)) at 
/home/kristina/code/mahara/htdocs/admin/upgrade.json.php:87

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1651011/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~mahara-contributors
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~mahara-contributors
More help   : https://help.launchpad.net/ListHelp

Reply via email to