Conditions | 6 |
Paths | 8 |
Total Lines | 26 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 6.1666 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | 30 | public function up() |
|
22 | { |
||
23 | 30 | $dataType = $this->binary(); |
|
24 | 30 | $tableOptions = null; |
|
25 | |||
26 | 30 | switch ($this->db->driverName) { |
|
27 | 30 | case 'mysql': |
|
28 | // https://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci |
||
29 | 10 | $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; |
|
30 | 10 | break; |
|
31 | 20 | case 'sqlsrv': |
|
32 | 20 | case 'mssql': |
|
33 | 20 | case 'dblib': |
|
34 | // "varbinary(max)" added in SQL Server 2012 (version 11.0.0) |
||
35 | if (version_compare($this->getDb()->getServerVersion(), '11.0.0') < 0) { |
||
36 | $dataType = $this->text(); |
||
37 | } |
||
38 | break; |
||
39 | } |
||
40 | |||
41 | 30 | $this->createTable('{{%session}}', [ |
|
42 | 30 | 'id' => $this->string()->notNull(), |
|
43 | 30 | 'expire' => $this->integer(), |
|
44 | 30 | 'data' => $dataType, |
|
45 | 30 | 'PRIMARY KEY ([[id]])', |
|
46 | ], $tableOptions); |
||
47 | 30 | } |
|
57 |