Test Failed
Push — develop ( 815500...0204ba )
by nguereza
02:34
created

AddRoleCode20210704170839   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 6 1
A down() 0 5 1
1
<?php
2
    namespace Platine\Framework\Migration;
3
4
use Platine\Database\Schema\AlterTable;
5
use Platine\Framework\Migration\AbstractMigration;
6
7
    class AddRoleCode20210704170839 extends AbstractMigration
8
    {
9
10
          public function up(): void
11
          {
12
            //Action when migrate up
13
            $this->alter('roles', function (AlterTable $table) {
14
                $table->string('code')->notNull();
15
                $table->unique('code');
16
            });
17
          }
18
19
          public function down(): void
20
          {
21
            //Action when migrate down
22
            $this->alter('roles', function (AlterTable $table) {
23
                $table->dropColumn('code');
24
            });
25
          }
26
    }