AddConfigurationTable20220109074106   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 30
c 2
b 0
f 0
dl 0
loc 49
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 4 1
A up() 0 40 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Platine\Framework\Migration;
6
7
use Platine\Database\Schema\CreateTable;
8
use Platine\Framework\Migration\AbstractMigration;
9
10
class AddConfigurationTable20220109074106 extends AbstractMigration
11
{
12
    public function up(): void
13
    {
14
      //Action when migrate up
15
        $this->create('configurations', function (CreateTable $table) {
16
            $table->integer('id')
17
                    ->autoincrement()
18
                    ->primary();
19
20
            $table->string('env')
21
                   ->description('The config environment')
22
                   ->index();
23
24
            $table->string('module')
25
                    ->description('The module')
26
                    ->index()
27
                    ->notNull();
28
29
            $table->string('name')
30
                  ->description('The config name')
31
                  ->index()
32
                  ->notNull();
33
34
            $table->text('value')
35
                    ->description('The config value');
36
37
            $table->string('type')
38
                   ->description('The config data type')
39
                   ->notNull();
40
41
            $table->text('comment')
42
                  ->description('The config description');
43
44
            $table->enum('status', ['Y', 'N'])
45
                 ->description('The config status')
46
                 ->defaultValue('Y')
47
                 ->notNull();
48
49
            $table->timestamps();
50
            
51
            $table->engine('INNODB');
52
        });
53
    }
54
55
    public function down(): void
56
    {
57
      //Action when migrate down
58
        $this->drop('configurations');
59
    }
60
}
61