Test Failed
Push — develop ( 0204ba...bd77d0 )
by nguereza
03:38
created

AddRolesCodeField20210705065339::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 10
c 1
b 0
f 0
1
<?php
2
namespace Platine\Framework\Migration;
3
4
use Platine\Database\Schema\AlterTable;
5
use Platine\Framework\Migration\AbstractMigration;
6
7
class AddRolesCodeField20210705065339 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
}