AddProductCategoriesTable20231207053927   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

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

2 Methods

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