mirror of
https://github.com/moodle/moodle.git
synced 2025-04-24 09:55:33 +02:00
MDL-29801 install: added message deleted fields
This commit is contained in:
parent
e28004e614
commit
1efd323842
@ -534,13 +534,15 @@
|
||||
<FIELD NAME="contexturl" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="If this message is a notification of an event contexturl should contain a link to view this event. For example if its a notification of a forum post contexturl should contain a link to the forum post."/>
|
||||
<FIELD NAME="contexturlname" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Display text for the contexturl"/>
|
||||
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="timeuserfromdeleted" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="timeusertodeleted" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="useridto" UNIQUE="false" FIELDS="useridto"/>
|
||||
<INDEX NAME="useridfromto" UNIQUE="false" FIELDS="useridfrom, useridto"/>
|
||||
<INDEX NAME="useridfromtodeleted" UNIQUE="false" FIELDS="useridfrom, useridto, timeuserfromdeleted, timeusertodeleted"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
<TABLE NAME="message_read" COMMENT="Stores all messages that have been read">
|
||||
@ -558,13 +560,15 @@
|
||||
<FIELD NAME="contexturlname" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Display text for the contexturl"/>
|
||||
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="timeread" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="timeuserfromdeleted" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="timeusertodeleted" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="useridto" UNIQUE="false" FIELDS="useridto"/>
|
||||
<INDEX NAME="useridfromto" UNIQUE="false" FIELDS="useridfrom, useridto"/>
|
||||
<INDEX NAME="useridfromtodeleted" UNIQUE="false" FIELDS="useridfrom, useridto, timeuserfromdeleted, timeusertodeleted"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
<TABLE NAME="message_contacts" COMMENT="Maintains lists of relationships between users">
|
||||
|
@ -4470,5 +4470,65 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2015082400.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015083100.00) {
|
||||
$table = new xmldb_table('message');
|
||||
|
||||
// Define the deleted fields to be added to the message tables.
|
||||
$field1 = new xmldb_field('timeuserfromdeleted', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0',
|
||||
'timecreated');
|
||||
$field2 = new xmldb_field('timeusertodeleted', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0',
|
||||
'timecreated');
|
||||
$oldindex = new xmldb_index('useridfromto', XMLDB_INDEX_NOTUNIQUE,
|
||||
array('useridfrom', 'useridto'));
|
||||
$newindex = new xmldb_index('useridfromtodeleted', XMLDB_INDEX_NOTUNIQUE,
|
||||
array('useridfrom', 'useridto', 'timeuserfromdeleted', 'timeusertodeleted'));
|
||||
|
||||
// Conditionally launch add field timeuserfromdeleted.
|
||||
if (!$dbman->field_exists($table, $field1)) {
|
||||
$dbman->add_field($table, $field1);
|
||||
}
|
||||
|
||||
// Conditionally launch add field timeusertodeleted.
|
||||
if (!$dbman->field_exists($table, $field2)) {
|
||||
$dbman->add_field($table, $field2);
|
||||
}
|
||||
|
||||
// Conditionally launch drop index useridfromto.
|
||||
if ($dbman->index_exists($table, $oldindex)) {
|
||||
$dbman->drop_index($table, $oldindex);
|
||||
}
|
||||
|
||||
// Conditionally launch add index useridfromtodeleted.
|
||||
if (!$dbman->index_exists($table, $newindex)) {
|
||||
$dbman->add_index($table, $newindex);
|
||||
}
|
||||
|
||||
// Now add them to the message_read table.
|
||||
$table = new xmldb_table('message_read');
|
||||
|
||||
// Conditionally launch add field timeuserfromdeleted.
|
||||
if (!$dbman->field_exists($table, $field1)) {
|
||||
$dbman->add_field($table, $field1);
|
||||
}
|
||||
|
||||
// Conditionally launch add field timeusertodeleted.
|
||||
if (!$dbman->field_exists($table, $field2)) {
|
||||
$dbman->add_field($table, $field2);
|
||||
}
|
||||
|
||||
// Conditionally launch drop index useridfromto.
|
||||
if ($dbman->index_exists($table, $oldindex)) {
|
||||
$dbman->drop_index($table, $oldindex);
|
||||
}
|
||||
|
||||
// Conditionally launch add index useridfromtodeleted.
|
||||
if (!$dbman->index_exists($table, $newindex)) {
|
||||
$dbman->add_index($table, $newindex);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015083100.00);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2015082800.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2015083100.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user