Migration::text()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 2
nc 2
nop 0
1
<?php
2
/**
3
 * @link https://github.com/zhuravljov/yii2-queue-monitor
4
 * @copyright Copyright (c) 2017 Roman Zhuravlev
5
 * @license http://opensource.org/licenses/BSD-3-Clause
6
 */
7
8
namespace zhuravljov\yii\queue\monitor\base;
9
10
use zhuravljov\yii\queue\monitor\Env;
11
12
/**
13
 * Class Migration
14
 *
15
 * @author Roman Zhuravlev <[email protected]>
16
 */
17
abstract class Migration extends \yii\db\Migration
18
{
19
    /**
20
     * @var Env
21
     */
22
    protected $env;
23
24
    /**
25
     * @param Env $env
26
     * @inheritdoc
27
     */
28
    public function __construct(Env $env, $config = [])
29
    {
30
        $this->env = $env;
31
        parent::__construct($config);
32
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37
    public function binary($length = null)
38
    {
39
        if ($this->db->driverName === 'mysql') {
40
            return $this->db->schema->createColumnSchemaBuilder('longblob');
41
        }
42
        return parent::binary($length);
43
    }
44
45
    /**
46
     * @inheritdoc
47
     */
48
    public function text()
49
    {
50
        if ($this->db->driverName === 'mysql') {
51
            return $this->db->schema->createColumnSchemaBuilder('longtext');
52
        }
53
        return parent::text();
54
    }
55
}
56