Total Complexity | 6 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 90.48% |
Changes | 0 |
1 | <?php |
||
16 | class m160313_153426_session_init extends Migration |
||
17 | { |
||
18 | /** |
||
19 | * {@inheritdoc} |
||
20 | */ |
||
21 | 21 | public function up() |
|
22 | { |
||
23 | 21 | $dataType = $this->binary(); |
|
24 | 21 | $tableOptions = null; |
|
25 | |||
26 | 21 | switch ($this->db->driverName) { |
|
27 | 21 | case 'mysql': |
|
28 | // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci |
||
29 | 7 | $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; |
|
30 | 7 | break; |
|
31 | 14 | case 'sqlsrv': |
|
32 | 14 | case 'mssql': |
|
33 | 14 | case 'dblib': |
|
34 | $dataType = $this->text(); |
||
35 | break; |
||
36 | } |
||
37 | |||
38 | 21 | $this->createTable('{{%session}}', [ |
|
39 | 21 | 'id' => $this->string()->notNull(), |
|
40 | 21 | 'expire' => $this->integer(), |
|
41 | 21 | 'data' => $dataType, |
|
42 | 21 | 'PRIMARY KEY ([[id]])', |
|
43 | 21 | ], $tableOptions); |
|
44 | 21 | } |
|
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | 21 | public function down() |
|
52 | 21 | } |
|
53 | } |
||
54 |