MDL-21116 drop plugin tables in opposite order
authorPetr Škoda <commits@skodak.org>
Sat, 22 Dec 2012 18:01:00 +0000 (19:01 +0100)
committerPetr Škoda <commits@skodak.org>
Sat, 22 Dec 2012 18:01:00 +0000 (19:01 +0100)
This should help with foreign key in the future.

lib/ddl/database_manager.php

index ea2621f..1112baf 100644 (file)
@@ -300,6 +300,8 @@ class database_manager {
         }
 
         if ($xmldb_tables = $structure->getTables()) {
+            // Delete in opposite order, this should help with foreign keys in the future.
+            $xmldb_tables = array_reverse($xmldb_tables);
             foreach($xmldb_tables as $table) {
                 if ($this->table_exists($table)) {
                     $this->drop_table($table);