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

AddRolesCodeField20210705065339   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 5 1
A up() 0 6 1
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
}