Completed
Push — master ( 04b5b1...93006a )
by Ben
02:22
created

CreateProductCostsTable::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateProductCostsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('product_costs', function (Blueprint $table) {
17
            $table->increments('id');
18
            $table->integer('product_id')->unsigned();
19
            $table->decimal('price', 10, 2);
20
            $table->timestamps();
21
22
23
            $table->foreign('product_id')->references('id')->on('products');
24
        });
25
    }
26
27
    /**
28
     * Reverse the migrations.
29
     *
30
     * @return void
31
     */
32
    public function down()
33
    {
34
        Schema::table('product_costs', function (Blueprint $table) {
35
            $table->dropForeign(['product_id']);
36
        });
37
38
        Schema::dropIfExists('product_costs');
39
    }
40
}
41