Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-19303 META: XMLDB Editor various bugs/improvements
  3. MDL-19701

In PHP code generation, detect field dependencies (XMLDB-based) and provide needed code

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Database SQL/XMLDB
    • Labels:
      None

      Description

      In Moodle 2.0 we have introduced field dependencies checking, so some actions, like dropping a field, now detect if there are some dependency (index using that field) and throws an exception if necessary.

      Make the XMLDB PHP generator able to find such dependencies (in the xmldb model, not in real db) and provide with the needed PHP code needed to avoid that exception, normally:

      • dropping the index/es before dropping the field for non unique indexes/keys
      • re-adding the index - with the dropped field out for non unique indexes/keys
      • BIG WARN if the dependent indexes/keys are defined as UNIQUE. Only drop is safe for 1-column indexes. Everything else, isn't because can lead to errors.

      References: http://moodle.org/mod/forum/discuss.php?d=127196 and MDL-19695

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                stronk7 Eloy Lafuente (stronk7)
                Participants:
                Component watchers:
                Jake Dallimore, Jun Pataleta, Ryan Wyllie
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: