Test Failed
Push — develop ( ebbd0c...8a31ce )
by nguereza
03:10
created

AddPermissionsTable20210717094547   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

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

2 Methods

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