mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-36941 core: added new messaging and notification tables
This commit is contained in:
parent
a15c745936
commit
a63f98245c
3 changed files with 188 additions and 1 deletions
|
@ -591,6 +591,82 @@
|
||||||
<INDEX NAME="useridto_timeusertodeleted_notification" UNIQUE="false" FIELDS="useridto, timeusertodeleted, notification"/>
|
<INDEX NAME="useridto_timeusertodeleted_notification" UNIQUE="false" FIELDS="useridto, timeusertodeleted, notification"/>
|
||||||
</INDEXES>
|
</INDEXES>
|
||||||
</TABLE>
|
</TABLE>
|
||||||
|
<TABLE NAME="messages" COMMENT="Stores all messages">
|
||||||
|
<FIELDS>
|
||||||
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
||||||
|
<FIELD NAME="useridfrom" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="conversationid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="subject" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="fullmessage" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="fullmessageformat" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="fullmessagehtml" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="smallmessage" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||||
|
</FIELDS>
|
||||||
|
<KEYS>
|
||||||
|
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||||
|
<KEY NAME="useridfrom" TYPE="foreign" FIELDS="useridfrom" REFTABLE="user" REFFIELDS="id"/>
|
||||||
|
<KEY NAME="conversationid" TYPE="foreign" FIELDS="conversationid" REFTABLE="message_conversations" REFFIELDS="id"/>
|
||||||
|
</KEYS>
|
||||||
|
</TABLE>
|
||||||
|
<TABLE NAME="message_conversations" COMMENT="Stores all message conversations">
|
||||||
|
<FIELDS>
|
||||||
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
||||||
|
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||||
|
</FIELDS>
|
||||||
|
<KEYS>
|
||||||
|
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||||
|
</KEYS>
|
||||||
|
</TABLE>
|
||||||
|
<TABLE NAME="message_conversation_members" COMMENT="Stores all members in a conversations">
|
||||||
|
<FIELDS>
|
||||||
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
||||||
|
<FIELD NAME="conversationid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||||
|
</FIELDS>
|
||||||
|
<KEYS>
|
||||||
|
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||||
|
<KEY NAME="conversationid" TYPE="foreign" FIELDS="conversationid" REFTABLE="message_conversations" REFFIELDS="id"/>
|
||||||
|
<KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
|
||||||
|
</KEYS>
|
||||||
|
</TABLE>
|
||||||
|
<TABLE NAME="message_user_actions" COMMENT="Stores all per-user actions on individual messages">
|
||||||
|
<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="messageid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="action" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="timecreated" 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="messageid" TYPE="foreign" FIELDS="messageid" REFTABLE="messages" REFFIELDS="id"/>
|
||||||
|
</KEYS>
|
||||||
|
</TABLE>
|
||||||
|
<TABLE NAME="notifications" COMMENT="Stores all notifications">
|
||||||
|
<FIELDS>
|
||||||
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
||||||
|
<FIELD NAME="useridfrom" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="useridto" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="subject" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="The message subject"/>
|
||||||
|
<FIELD NAME="fullmessage" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="fullmessageformat" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="fullmessagehtml" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="smallmessage" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="component" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="eventtype" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="contexturl" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="contexturlname" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="timeread" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
|
||||||
|
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
||||||
|
</FIELDS>
|
||||||
|
<KEYS>
|
||||||
|
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||||
|
<KEY NAME="useridto" TYPE="foreign" FIELDS="useridto" REFTABLE="user" REFFIELDS="id"/>
|
||||||
|
</KEYS>
|
||||||
|
</TABLE>
|
||||||
<TABLE NAME="message_contacts" COMMENT="Maintains lists of relationships between users">
|
<TABLE NAME="message_contacts" COMMENT="Maintains lists of relationships between users">
|
||||||
<FIELDS>
|
<FIELDS>
|
||||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
||||||
|
|
|
@ -2020,5 +2020,116 @@ function xmldb_main_upgrade($oldversion) {
|
||||||
upgrade_main_savepoint(true, 2018022800.03);
|
upgrade_main_savepoint(true, 2018022800.03);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($oldversion < 2018032200.01) {
|
||||||
|
// Define table 'messages' to be created.
|
||||||
|
$table = new xmldb_table('messages');
|
||||||
|
|
||||||
|
// Adding fields to table 'messages'.
|
||||||
|
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||||
|
$table->add_field('useridfrom', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
$table->add_field('conversationid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
$table->add_field('subject', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||||
|
$table->add_field('fullmessage', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||||
|
$table->add_field('fullmessageformat', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 0);
|
||||||
|
$table->add_field('fullmessagehtml', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||||
|
$table->add_field('smallmessage', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||||
|
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
|
||||||
|
// Adding keys to table 'messages'.
|
||||||
|
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||||
|
$table->add_key('useridfrom', XMLDB_KEY_FOREIGN, array('useridfrom'), 'user', array('id'));
|
||||||
|
$table->add_key('conversationid', XMLDB_KEY_FOREIGN, array('conversationid'), 'message_conversations', array('id'));
|
||||||
|
|
||||||
|
// Conditionally launch create table for 'messages'.
|
||||||
|
if (!$dbman->table_exists($table)) {
|
||||||
|
$dbman->create_table($table);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define table 'message_conversations' to be created.
|
||||||
|
$table = new xmldb_table('message_conversations');
|
||||||
|
|
||||||
|
// Adding fields to table 'message_conversations'.
|
||||||
|
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||||
|
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
|
||||||
|
// Adding keys to table 'message_conversations'.
|
||||||
|
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||||
|
|
||||||
|
// Conditionally launch create table for 'message_conversations'.
|
||||||
|
if (!$dbman->table_exists($table)) {
|
||||||
|
$dbman->create_table($table);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define table 'message_conversation_members' to be created.
|
||||||
|
$table = new xmldb_table('message_conversation_members');
|
||||||
|
|
||||||
|
// Adding fields to table 'message_conversation_members'.
|
||||||
|
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||||
|
$table->add_field('conversationid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
|
||||||
|
// Adding keys to table 'message_conversation_members'.
|
||||||
|
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||||
|
$table->add_key('conversationid', XMLDB_KEY_FOREIGN, array('conversationid'), 'message_conversations', array('id'));
|
||||||
|
$table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
|
||||||
|
|
||||||
|
// Conditionally launch create table for 'message_conversation_members'.
|
||||||
|
if (!$dbman->table_exists($table)) {
|
||||||
|
$dbman->create_table($table);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define table 'message_user_actions' to be created.
|
||||||
|
$table = new xmldb_table('message_user_actions');
|
||||||
|
|
||||||
|
// Adding fields to table 'message_user_actions'.
|
||||||
|
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||||
|
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
$table->add_field('messageid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
$table->add_field('action', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
|
||||||
|
// Adding keys to table 'message_user_actions'.
|
||||||
|
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||||
|
$table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
|
||||||
|
$table->add_key('messageid', XMLDB_KEY_FOREIGN, array('messageid'), 'messages', array('id'));
|
||||||
|
|
||||||
|
// Conditionally launch create table for 'message_user_actions'.
|
||||||
|
if (!$dbman->table_exists($table)) {
|
||||||
|
$dbman->create_table($table);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define table 'notifications' to be created.
|
||||||
|
$table = new xmldb_table('notifications');
|
||||||
|
|
||||||
|
// Adding fields to table 'notifications'.
|
||||||
|
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||||
|
$table->add_field('useridfrom', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
$table->add_field('useridto', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
$table->add_field('subject', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||||
|
$table->add_field('fullmessage', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||||
|
$table->add_field('fullmessageformat', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 0);
|
||||||
|
$table->add_field('fullmessagehtml', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||||
|
$table->add_field('smallmessage', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||||
|
$table->add_field('component', XMLDB_TYPE_CHAR, '100', null, null, null, null);
|
||||||
|
$table->add_field('eventtype', XMLDB_TYPE_CHAR, '100', null, null, null, null);
|
||||||
|
$table->add_field('contexturl', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||||
|
$table->add_field('contexturlname', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||||
|
$table->add_field('timeread', XMLDB_TYPE_INTEGER, '10', null, false, null, null);
|
||||||
|
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||||
|
|
||||||
|
// Adding keys to table 'notifications'.
|
||||||
|
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||||
|
$table->add_key('useridto', XMLDB_KEY_FOREIGN, array('useridto'), 'user', array('id'));
|
||||||
|
|
||||||
|
// Conditionally launch create table for 'notifications'.
|
||||||
|
if (!$dbman->table_exists($table)) {
|
||||||
|
$dbman->create_table($table);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Main savepoint reached.
|
||||||
|
upgrade_main_savepoint(true, 2018032200.01);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
$version = 2018032200.00; // YYYYMMDD = weekly release date of this DEV branch.
|
$version = 2018032200.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||||
// RR = release increments - 00 in DEV branches.
|
// RR = release increments - 00 in DEV branches.
|
||||||
// .XX = incremental changes.
|
// .XX = incremental changes.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue