1 | <?php |
||
8 | class m180530_133910_create_feedback_table extends Migration |
||
9 | { |
||
10 | /** |
||
11 | * {@inheritdoc} |
||
12 | */ |
||
13 | public function safeUp() |
||
14 | { |
||
15 | $this->createTable('feedback', [ |
||
16 | 'id' => $this->primaryKey(), |
||
17 | 'name' => $this->string(64)->notNull(), |
||
18 | 'email' => $this->string(64)->notNull(), |
||
19 | 'phone' => $this->string(32), |
||
20 | 'subject' => $this->string()->notNull(), |
||
21 | 'message' => $this->text()->notNull(), |
||
22 | 'read' => $this->tinyInteger()->notNull()->defaultValue(0), |
||
23 | 'created_at' => $this->dateTime(), |
||
24 | 'updated_at' => $this->dateTime(), |
||
25 | ]); |
||
26 | |||
27 | $this->createIndex( |
||
28 | 'idx-feedback-read', |
||
29 | 'feedback', |
||
30 | 'read' |
||
31 | ); |
||
32 | |||
33 | $this->createIndex( |
||
34 | 'idx-feedback-name', |
||
35 | 'feedback', |
||
36 | 'name' |
||
37 | ); |
||
38 | |||
39 | $this->createIndex( |
||
40 | 'idx-feedback-email', |
||
41 | 'feedback', |
||
42 | 'email' |
||
43 | ); |
||
44 | |||
45 | $this->createIndex( |
||
46 | 'idx-feedback-phone', |
||
47 | 'feedback', |
||
48 | 'phone' |
||
49 | ); |
||
50 | |||
51 | $this->createIndex( |
||
52 | 'idx-feedback-subject', |
||
53 | 'feedback', |
||
54 | 'subject' |
||
55 | ); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function safeDown() |
||
89 | } |
||
90 | } |
||
91 |