Passed
Push — master ( a50708...5e7214 )
by Gianluca
04:57
created

CreateProductsTable::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreateProductsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('products', function (Blueprint $table) {
17
            $table->id();
18
            $table->string('name');
19
            $table->text('description');
20
            $table->longText('long_description')->nullable();
21
            $table->decimal('price');
22
            $table->text('image_path');
23
            $table->text('big_image_path');
24
            $table->integer('ml')->nullable();
25
            $table->decimal('alcholic')->nullable();
26
            $table->integer('quantity');
27
            $table->decimal('weight')->nullable();
28
            $table->boolean('in_home')->default(false);
29
            $table->unsignedBigInteger('category_id');
30
            $table->timestamps();
31
32
            //foreign
33
            $table->foreign('category_id')->references('id')->on('categories');
34
        });
35
    }
36
37
    /**
38
     * Reverse the migrations.
39
     *
40
     * @return void
41
     */
42
    public function down()
43
    {
44
        Schema::dropIfExists('products');
45
    }
46
}
47