-
Notifications
You must be signed in to change notification settings - Fork 4
/
database.php
40 lines (33 loc) · 1.13 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
<?php
// The SQL to uninstall this tool
$DATABASE_UNINSTALL = array(
);
// The SQL to create the tables if they don't exist
$DATABASE_INSTALL = array(
array( "{$CFG->dbprefix}photo_gallery",
"create table {$CFG->dbprefix}photo_gallery (
photo_id INTEGER NOT NULL AUTO_INCREMENT,
user_id INTEGER NOT NULL,
description TEXT NULL,
blob_id INTEGER NOT NULL,
thumb_id INTEGER NULL,
approved BOOL DEFAULT 0,
PRIMARY KEY(photo_id)
) ENGINE = InnoDB DEFAULT CHARSET=utf8"),
array( "{$CFG->dbprefix}gallery_main",
"create table {$CFG->dbprefix}gallery_main (
link_id INTEGER NOT NULL,
approval BOOL DEFAULT 0,
PRIMARY KEY(link_id)
) ENGINE = InnoDB DEFAULT CHARSET=utf8")
);
$DATABASE_UPGRADE = function($oldversion) {
global $CFG, $PDOX;
if ( ! $PDOX->columnExists('thumb_id', "{$CFG->dbprefix}photo_gallery") ) {
$sql= "ALTER TABLE {$CFG->dbprefix}photo_gallery ADD thumb_id INTEGER NULL";
echo("Upgrading: ".$sql."<br/>\n");
error_log("Upgrading: ".$sql);
$q = $PDOX->queryDie($sql);
}
return 202002101610;
};