Passed
Push — develop ( a95732...cd40df )
by Septianata
12:51
created

anonymous//database/migrations/2021_05_22_000012_create_items_table.php$0   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 9
c 0
b 0
f 0
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A 2021_05_22_000012_create_items_table.php$0 ➔ down() 0 3 1
A 2021_05_22_000012_create_items_table.php$0 ➔ up() 0 10 1
1
<?php
2
3
use App\Models\Denomination;
4
use App\Models\Order;
5
use Illuminate\Database\Migrations\Migration;
6
use Illuminate\Database\Schema\Blueprint;
7
use Illuminate\Support\Facades\Schema;
8
9
/**
10
 * @see \App\Models\Item
11
 */
12
return new class extends Migration
13
{
14
    /**
15
     * Run the migrations.
16
     *
17
     * @return void
18
     */
19
    public function up()
20
    {
21
        Schema::create('items', function (Blueprint $table) {
22
            $table->id();
23
            $table->foreignIdFor(Order::class)->constrained()->onUpdate('cascade')->onDelete('cascade');
24
            $table->foreignIdFor(Denomination::class)->constrained()->onUpdate('cascade')->onDelete('cascade');
25
26
            $table->unsignedInteger('quantity_per_bundle');
27
            $table->unsignedInteger('bundle_quantity');
28
            $table->timestamps();
29
        });
30
    }
31
32
    /**
33
     * Reverse the migrations.
34
     *
35
     * @return void
36
     */
37
    public function down()
38
    {
39
        Schema::dropIfExists('items');
40
    }
41
};
42