-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.php
65 lines (49 loc) · 2.22 KB
/
scripts.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
55
56
57
58
59
60
61
62
63
64
65
<?php
return [
'install' => function ($app) {
$util = $app['db']->getUtility();
if ($util->tableExists('@emailsender_emailtext') === false) {
$util->createTable('@emailsender_emailtext', function ($table) {
$table->addColumn('id', 'integer', ['unsigned' => true, 'length' => 10, 'autoincrement' => true]);
$table->addColumn('type', 'string', ['length' => 64]);
$table->addColumn('description', 'string', ['length' => 255, 'notnull' => false]);
$table->addColumn('subject', 'string', ['length' => 255, 'notnull' => false]);
$table->addColumn('content', 'text', ['notnull' => false]);
$table->addColumn('roles', 'simple_array', ['notnull' => false]);
$table->addColumn('data', 'json_array', ['notnull' => false]);
$table->setPrimaryKey(['id']);
});
}
if ($util->tableExists('@emailsender_emaillog') === false) {
$util->createTable('@emailsender_emaillog', function ($table) {
$table->addColumn('id', 'integer', ['unsigned' => true, 'length' => 10, 'autoincrement' => true]);
$table->addColumn('sent', 'datetime');
$table->addColumn('ext_key', 'string', ['notnull' => false]);
$table->addColumn('from_name', 'string', ['notnull' => false]);
$table->addColumn('from_email', 'string');
$table->addColumn('recipients', 'simple_array');
$table->addColumn('cc', 'simple_array', ['notnull' => false]);
$table->addColumn('bcc', 'simple_array', ['notnull' => false]);
$table->addColumn('type', 'string', ['length' => 64]);
$table->addColumn('subject', 'string', ['length' => 255, 'notnull' => false]);
$table->addColumn('content', 'text', ['notnull' => false]);
$table->addColumn('data', 'json_array', ['notnull' => false]);
$table->setPrimaryKey(['id']);
$table->addIndex(['ext_key'], 'EMAILSENDER_EMAILLOG_EXT_KEY');
});
}
},
'uninstall' => function ($app) {
$util = $app['db']->getUtility();
if ($util->tableExists('@emailsender_emailtext')) {
$util->dropTable('@emailsender_emailtext');
}
if ($util->tableExists('@emailsender_emaillog')) {
$util->dropTable('@emailsender_emaillog');
}
// remove the config
$app['config']->remove('bixie/emailsender');
},
'updates' => [
]
];