Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-13624

Some tag related columns are using bigint(11) as PK

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9.10
    • Component/s: Tags
    • Labels:
      None
    • Database:
      Any
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      While this shouldn't be critical, I've detected that some tags tables have some columns defined as BIGINT(11) and they should be BIGINT(10).

      More exactly, incorrect columns are:

      At install.xml:

      tag->id
      tag_correlation->id
      tag_instance->id

      At upgrade.php:

      tag->id
      tag->userid
      tag_correlation->id
      tag_correlation->tagid
      tag_instance->id
      tag_instance->tagid
      tag_instance->itemid

      There are two alternatives:

      1) Don't perform any upgrade to fix this but fix the above mistakes to make new installs and upgrades to create DB structures properly.

      2) Fix above mistakes and provide one upgrade step to fix them in servers running 1.9. Note that this step is complex because it includes changing PK columns and columns with indexes so perhaps the best approach is to:

      • rename current tables.
      • create the correct tables.
      • copy contents** (being careful with autonumeric ids that should be recalculated).
      • drop old tables.

      IMO 1) could be enough, but 2) is the 100% correct solution. For your consideration.

      Ciao

        • This means we must iterate over all the tags in wrong tables, inserting them in new tables and annotating all the old ids and new ids pairs to be used in the copy of the tag_instance and tag_correlation tables. We cannot perform the copy in one INSERT... SELECT statement. Must do that "manually".

        Attachments

          Activity

            People

            • Assignee:
              scyrma Mathieu Petit-Clair
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                25/Oct/10