AddRolesTable20210705065247   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 18 1
A down() 0 4 1
1
<?php
2
3
namespace Platine\Framework\Migration;
4
5
use Platine\Database\Schema\CreateTable;
6
use Platine\Framework\Migration\AbstractMigration;
7
8
class AddRolesTable20210705065247 extends AbstractMigration
9
{
10
    public function up(): void
11
    {
12
      //Action when migrate up
13
        $this->create('roles', function (CreateTable $table) {
14
            $table->integer('id')
15
                  ->autoincrement()
16
                 ->primary();
17
            
18
            $table->string('name')
19
                 ->description('The role name')
20
                 ->notNull();
21
            
22
            $table->string('description')
23
                 ->description('The role description');
24
            
25
            $table->timestamps();
26
27
            $table->engine('INNODB');
28
        });
29
    }
30
31
    public function down(): void
32
    {
33
      //Action when migrate down
34
        $this->drop('roles');
35
    }
36
}
37