← Back to team overview

mahara-contributors team mailing list archive

[Bug 1262932] [NEW] Bad data in the DB can cause the schema correction SQL to throw a fatal error

 

Public bug reported:

Looking at this forum post
https://mahara.org/interaction/forum/topic.php?id=5986&offset=0&limit=10
...

It occurs to me that there's a problem in our schema correction code.
We're adding foreign keys to existing tables, but we didn't first check
to see whether the tables have data that will fit that foreign key. If
they have bad data, then this upgrade script will error out and prevent
them from upgrading. And since these missing schema elements are not
vital, we don't want their failure to block upgrade.

We should have put a "catch (SQLException $e)" block around each attempt
to add a foreign key, unique index, and/or primary key, or another other
schema element that will fail if their data isn't clean. :-P

** Affects: mahara
     Importance: Undecided
         Status: New

-- 
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/1262932

Title:
  Bad data in the DB can cause the schema correction SQL to throw a
  fatal error

Status in Mahara ePortfolio:
  New

Bug description:
  Looking at this forum post
  https://mahara.org/interaction/forum/topic.php?id=5986&offset=0&limit=10
  ...

  It occurs to me that there's a problem in our schema correction code.
  We're adding foreign keys to existing tables, but we didn't first
  check to see whether the tables have data that will fit that foreign
  key. If they have bad data, then this upgrade script will error out
  and prevent them from upgrading. And since these missing schema
  elements are not vital, we don't want their failure to block upgrade.

  We should have put a "catch (SQLException $e)" block around each
  attempt to add a foreign key, unique index, and/or primary key, or
  another other schema element that will fail if their data isn't clean.
  :-P

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


Follow ups

References