CreateCategoriesTableMigration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 3 1
A up() 0 18 1
1
<?php
2
3
use Phpmig\Migration\Migration;
4
use Illuminate\Database\Capsule\Manager as Capsule;
5
6
class CreateCategoriesTableMigration extends Migration
7
{
8
    /**
9
     * Do the migration
10
     */
11
    public function up()
12
    {
13
        Capsule::schema()->create('categories', function ($table) {
14
            $table->increments('id');
15
            $table->string('title')->nullable();
16
            $table->string('slug')->unique();
17
            $table->text('body')->nullable();
18
            $table->integer('item_cnt')->unsigned()->default(0);
19
            $table->enum('is_active',['yes','no'])->default('yes');
20
            $table->enum('has_pic',['yes','no'])->default('no');
21
22
            $table->string('meta_title',128)->nullable();
23
            $table->string('meta_description',256)->nullable();
24
            $table->string('meta_keywords',64)->nullable();
25
26
            /*Add Soft Delete To Articles*/
27
            $table->softDeletes();
28
            $table->timestamps();
29
        });
30
31
32
    }
33
34
    /**
35
     * Undo the migration
36
     */
37
    public function down()
38
    {
39
        Capsule::schema()->drop('categories');
40
    }
41
}