-
Notifications
You must be signed in to change notification settings - Fork 1
/
database.php
54 lines (39 loc) · 1.98 KB
/
database.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
// The SQL to uninstall this tool
$DATABASE_UNINSTALL = array();
/** Table names */
$TEMPLATE_ALERT_TABLE_NAME = "{$CFG->dbprefix}template_alert";
$TEMPLATE_COMMENT_TABLE_NAME = "{$CFG->dbprefix}template_comment";
/** Table schemas */
$TEMPLATE_ALERT = "CREATE TABLE {$TEMPLATE_ALERT_TABLE_NAME} (
/* PRIMARY KEY */
alert_id INTEGER NOT NULL AUTO_INCREMENT,
/* COMMON COLS */
user_id INTEGER NOT NULL, /* ID of the instructor the created the settings */
context_id INTEGER NOT NULL, /* Tracked and scoped, this is the course */
link_id INTEGER NOT NULL, /* Tracked but not scoped, this is the instance */
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
/* TEMPLATE ALERT COLS */
alert_message TEXT NOT NULL,
alert_type VARCHAR(255) NOT NULL,
PRIMARY KEY(alert_Id)
) ENGINE = InnoDB DEFAULT CHARSET=utf8";
$TEMPLATE_COMMENT = "CREATE TABLE {$TEMPLATE_COMMENT_TABLE_NAME} (
/* PRIMARY KEY */
comment_id INTEGER NOT NULL AUTO_INCREMENT,
/* COMMON COLS */
user_id INTEGER NOT NULL, /* ID of the instructor the created the settings */
context_id INTEGER NOT NULL, /* Tracked and scoped, this is the course */
link_id INTEGER NOT NULL, /* Tracked but not scoped, this is the instance */
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
/* TEMPLATE COMMENT COLS */
comment_message TEXT NOT NULL,
PRIMARY KEY(comment_id)
) ENGINE = InnoDB DEFAULT CHARSET=utf8";
/** Table installation (if tables don't exist) */
$DATABASE_INSTALL = array(
array($TEMPLATE_ALERT_TABLE_NAME, $TEMPLATE_ALERT),
array($TEMPLATE_COMMENT_TABLE_NAME, $TEMPLATE_COMMENT),
);