Passed
Push — master ( 313c53...eadb07 )
by Mihail
04:44
created

update_cms_310::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
use Ffcms\Core\Migrations\MigrationInterface;
4
use Ffcms\Core\Migrations\Migration;
5
6
/**
7
 * Class update_cms_310
8
 */
9
class update_cms_310 extends Migration implements MigrationInterface
10
{
11
    /**
12
     * Implement new update changes
13
     * @return void
14
     */
15
    public function up()
16
    {
17
        $this->getSchema()->table('users', function($table){
18
            $table->string('approve_token', 128)->nullable()->default(null)->change();
19
        });
20
        // set approve_token = null where it like '0' str or ''
21
        \Apps\ActiveRecord\User::where('approve_token', '=', '0')
22
            ->update('approve_token', null);
0 ignored issues
show
Bug introduced by
'approve_token' of type string is incompatible with the type array expected by parameter $attributes of Illuminate\Database\Eloquent\Model::update(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
            ->update(/** @scrutinizer ignore-type */ 'approve_token', null);
Loading history...
Bug introduced by
null of type null is incompatible with the type array expected by parameter $options of Illuminate\Database\Eloquent\Model::update(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
            ->update('approve_token', /** @scrutinizer ignore-type */ null);
Loading history...
23
    }
24
25
    /**
26
     * @return void
27
     */
28
    public function down()
29
    {
30
        parent::down(); // TODO: Change the autogenerated stub
31
    }
32
33
    /**
34
     * Seed created table via up() method with some data
35
     * @return void
36
     */
37
    public function seed()
38
    {
39
        // TODO: Implement seed() method.
40
    }
41
}