|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace bedezign\yii2\audit\migrations; |
|
4
|
|
|
|
|
5
|
|
|
use bedezign\yii2\audit\components\Migration; |
|
6
|
|
|
use yii\db\Schema; |
|
7
|
|
|
|
|
8
|
|
|
class m150626_000006_create_audit_mail extends Migration |
|
9
|
|
|
{ |
|
10
|
|
|
const TABLE = '{{%audit_mail}}'; |
|
11
|
|
|
|
|
12
|
|
|
public function up() |
|
13
|
|
|
{ |
|
14
|
|
|
$this->createTable(self::TABLE, [ |
|
15
|
|
|
'id' => Schema::TYPE_PK, |
|
16
|
|
|
'entry_id' => Schema::TYPE_INTEGER . ' NOT NULL', |
|
17
|
|
|
'created' => Schema::TYPE_DATETIME . ' NOT NULL', |
|
18
|
|
|
'successful' => Schema::TYPE_INTEGER . ' NOT NULL', |
|
19
|
|
|
'from' => Schema::TYPE_STRING, |
|
20
|
|
|
'to' => Schema::TYPE_STRING, |
|
21
|
|
|
'reply' => Schema::TYPE_STRING, |
|
22
|
|
|
'cc' => Schema::TYPE_STRING, |
|
23
|
|
|
'bcc' => Schema::TYPE_STRING, |
|
24
|
|
|
'subject' => Schema::TYPE_STRING, |
|
25
|
|
|
'text' => Schema::TYPE_BINARY, |
|
26
|
|
|
'html' => Schema::TYPE_BINARY, |
|
27
|
|
|
'data' => Schema::TYPE_BINARY, |
|
28
|
|
|
], $this->db->driverName === 'mysql' ? 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB' : null); |
|
29
|
|
|
|
|
30
|
|
|
if ($this->db->driverName != 'sqlite') { |
|
31
|
|
|
$this->addForeignKey('fk_audit_mail_entry_id', self::TABLE, ['entry_id'], '{{%audit_entry}}', 'id'); |
|
32
|
|
|
} |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function down() |
|
36
|
|
|
{ |
|
37
|
|
|
if ($this->db->driverName != 'sqlite') { |
|
38
|
|
|
$this->dropForeignKey('fk_audit_mail_entry_id', self::TABLE); |
|
39
|
|
|
} |
|
40
|
|
|
$this->dropTable(self::TABLE); |
|
41
|
|
|
} |
|
42
|
|
|
} |
|
43
|
|
|
|