MDL-36941 message_popup: do not remove message_popup table
authorMark Nelson <markn@moodle.com>
Wed, 28 Mar 2018 11:53:21 +0000 (19:53 +0800)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 28 Mar 2018 16:16:46 +0000 (18:16 +0200)
This is a partial revert of commit 123631ad4718141627d77027dbef0448bae22ac8.

Most of the logic was NOT reverted, just the part deleting the table was.

Note - this fix was done on integration.git and as a result no
upgrade step was added to re-introduce the table, sorry! This
means for those on integration.git you will have to re-install
your Moodle site so the 'message_popup' table is present.

Please see tracker for comments as to why we need to keep it! :)

message/output/popup/db/install.xml [new file with mode: 0644]
message/output/popup/db/upgrade.php

diff --git a/message/output/popup/db/install.xml b/message/output/popup/db/install.xml
new file mode 100644 (file)
index 0000000..bb7a992
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<XMLDB PATH="message/output/popup/db" VERSION="20161221" COMMENT="XMLDB file for Moodle message/output/popup"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
+>
+  <TABLES>
+    <TABLE NAME="message_popup" COMMENT="Keep state of notifications for the popup message processor">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
+        <FIELD NAME="messageid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
+        <FIELD NAME="isread" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
+      </KEYS>
+      <INDEXES>
+        <INDEX NAME="messageid-isread" UNIQUE="true" FIELDS="messageid, isread"/>
+        <INDEX NAME="isread" UNIQUE="false" FIELDS="isread"/>
+      </INDEXES>
+    </TABLE>
+  </TABLES>
+</XMLDB>
index 26f3b1e..455d89a 100644 (file)
@@ -83,16 +83,5 @@ function xmldb_message_popup_upgrade($oldversion) {
     // Automatically generated Moodle v3.4.0 release upgrade line.
     // Put any upgrade step following this.
 
     // Automatically generated Moodle v3.4.0 release upgrade line.
     // Put any upgrade step following this.
 
-    if ($oldversion < 2018022000) {
-        // Drop table that is no longer needed.
-        $table = new xmldb_table('message_popup');
-        if ($dbman->table_exists($table)) {
-            $dbman->drop_table($table);
-        }
-
-        // Popup savepoint reached.
-        upgrade_plugin_savepoint(true, 2018022000, 'message', 'popup');
-    }
-
     return true;
 }
     return true;
 }