Conditions | 6 |
Paths | 8 |
Total Lines | 28 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 6.5625 |
Changes | 1 | ||
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 | $version = $this->db->createCommand("SELECT SERVERPROPERTY('productversion')")->queryScalar(); |
||
35 | $version = explode('.', $version, 2); |
||
|
|||
36 | // "varbinary(max)" added in SQL Server 2012 (version 11.*) |
||
37 | if ($version < 11) { |
||
38 | $dataType = $this->text(); |
||
39 | } |
||
40 | break; |
||
41 | } |
||
42 | |||
43 | 30 | $this->createTable('{{%session}}', [ |
|
44 | 30 | 'id' => $this->string()->notNull(), |
|
45 | 30 | 'expire' => $this->integer(), |
|
46 | 30 | 'data' => $dataType, |
|
47 | 30 | 'PRIMARY KEY ([[id]])', |
|
48 | ], $tableOptions); |
||
49 | 30 | } |
|
59 |