Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Database SQL/XMLDB
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      Code to check that to current db schema matches install.xml.

        Gliffy Diagrams

          Activity

          Hide
          mjollnir Penny Leach added a comment -

          Hey Andrei,

          Couple things:

          • obviously I can see you have a TODO about localising strings
          • You're checking for fields that exist in the database but not the schema, but not whole tables that exist in the database but not the schema. Perhaps you need to something similar to this:

          unset($dbfields[$fieldname]);
          paired with:
          foreach($dbfields as $fieldname=>$info) {
          $errors[$tablename][] = 'Field ' . $fieldname . ' is unexpected.'
          }

          but for tables.

          Other than that, it looks good to me.

          Show
          mjollnir Penny Leach added a comment - Hey Andrei, Couple things: obviously I can see you have a TODO about localising strings You're checking for fields that exist in the database but not the schema, but not whole tables that exist in the database but not the schema. Perhaps you need to something similar to this: unset($dbfields [$fieldname] ); paired with: foreach($dbfields as $fieldname=>$info) { $errors [$tablename] [] = 'Field ' . $fieldname . ' is unexpected.' } but for tables. Other than that, it looks good to me.
          Hide
          abautu Andrei Bautu added a comment -

          We have this comment "we ignore other tables from the database since this can be a shared with other applications". People can have other tables in a Moodle database. We don't mind about them, because the will not export/import them.

          Show
          abautu Andrei Bautu added a comment - We have this comment "we ignore other tables from the database since this can be a shared with other applications". People can have other tables in a Moodle database. We don't mind about them, because the will not export/import them.
          Hide
          mjollnir Penny Leach added a comment -

          Yep, but what about ones that start with mdl_ ?

          Show
          mjollnir Penny Leach added a comment - Yep, but what about ones that start with mdl_ ?
          Hide
          skodak Petr Skoda added a comment -

          you can safely ignore the mdl_pma_xxx tables used by phpmyadmin
          there is also one table from adodb without prefix that can be safely ignored

          Show
          skodak Petr Skoda added a comment - you can safely ignore the mdl_pma_xxx tables used by phpmyadmin there is also one table from adodb without prefix that can be safely ignored
          Hide
          abautu Andrei Bautu added a comment -

          I would say that if they are not in the install.xml files, then we don't care about them, even if their names start with mdl_. I can change this if you want to.

          Show
          abautu Andrei Bautu added a comment - I would say that if they are not in the install.xml files, then we don't care about them, even if their names start with mdl_. I can change this if you want to.
          Hide
          skodak Petr Skoda added a comment -

          in cvs with minor changes, it is a bit more strict
          thanks!

          Show
          skodak Petr Skoda added a comment - in cvs with minor changes, it is a bit more strict thanks!

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                24/Nov/10