MDL-62459 database: remove unused table role_sortorder
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 28 Mar 2019 22:41:36 +0000 (23:41 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Sun, 21 Apr 2019 23:37:14 +0000 (01:37 +0200)
lib/db/install.xml
lib/db/upgrade.php
privacy/tests/provider_test.php
version.php

index 9631290..c924dba 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20190402" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20190403" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
         <INDEX NAME="roleid-contextid" UNIQUE="true" FIELDS="roleid, contextid"/>
       </INDEXES>
     </TABLE>
-    <TABLE NAME="role_sortorder" COMMENT="sort order of course managers in a course">
-      <FIELDS>
-        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
-        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
-        <FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
-        <FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
-        <FIELD NAME="sortoder" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
-      </FIELDS>
-      <KEYS>
-        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
-        <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
-        <KEY NAME="roleid" TYPE="foreign" FIELDS="roleid" REFTABLE="role" REFFIELDS="id"/>
-        <KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
-      </KEYS>
-      <INDEXES>
-        <INDEX NAME="userid-roleid-contextid" UNIQUE="true" FIELDS="userid, roleid, contextid"/>
-      </INDEXES>
-    </TABLE>
     <TABLE NAME="role_context_levels" COMMENT="Lists which roles can be assigned at which context levels. The assignment is allowed in the corresponding row is present in this table.">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
       </INDEXES>
     </TABLE>
   </TABLES>
-</XMLDB>
\ No newline at end of file
+</XMLDB>
index 76dc143..a9dec83 100644 (file)
@@ -3000,5 +3000,19 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2019041300.01);
     }
 
+    if ($oldversion < 2019042200.00) {
+
+        // Define table role_sortorder to be dropped.
+        $table = new xmldb_table('role_sortorder');
+
+        // Conditionally launch drop table for role_sortorder.
+        if ($dbman->table_exists($table)) {
+            $dbman->drop_table($table);
+        }
+
+        // Main savepoint reached.
+        upgrade_main_savepoint(true, 2019042200.00);
+    }
+
     return true;
 }
index 95f6525..ce6c443 100644 (file)
@@ -303,10 +303,6 @@ class provider_testcase extends advanced_testcase {
             $tablelist = $structure->getTables();
 
             foreach ($tablelist as $table) {
-                if ($table->getName() === 'role_sortorder') {
-                    // TODO MDL-62459 this table is not used anywhere. Remove the table and this statement.
-                    continue;
-                }
                 if ($fields = $this->get_userid_fields($table)) {
                     $tables[$table->getName()] = '  - ' . $table->getName() . ' (' . join(', ', $fields) . ')';
                 }
index c6d2eb5..03a62d6 100644 (file)
@@ -29,7 +29,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$version  = 2019041800.00;              // YYYYMMDD      = weekly release date of this DEV branch.
+$version  = 2019042200.00;              // YYYYMMDD      = weekly release date of this DEV branch.
                                         //         RR    = release increments - 00 in DEV branches.
                                         //           .XX = incremental changes.