forked from mythril/skyhook
-
Notifications
You must be signed in to change notification settings - Fork 2
/
update.php
42 lines (33 loc) · 844 Bytes
/
update.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
<?php
require_once __DIR__ . '/includes/autoload.php';
$db = new DB();
$stmt = $db->query("SHOW COLUMNS FROM `purchases`;");
$addEmailToNotify = true;
$addNTXID = true;
foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
echo $row['Field'] . "\n";
if ($row['Field'] === 'email_to_notify') {
$addEmailToNotify = false;
}
if ($row['Field'] === 'ntxid') {
$addNTXID = false;
}
}
if ($addEmailToNotify) {
$db->query('
ALTER TABLE `purchases`
ADD COLUMN
email_to_notify TEXT NULL DEFAULT NULL AFTER notice;
');
echo "Column 'email_to_notify' added.\n";
}
if ($addNTXID) {
$db->query('
ALTER TABLE `purchases`
ADD COLUMN
`ntxid` VARCHAR(64) NULL DEFAULT NULL AFTER txid;
');
echo "Column 'ntxid' added.\n";
}
$stmt = $db->query(file_get_contents(__DIR__ . '/database/jobs.sql'));
echo "update finished\n";