CreateShoppingCartTable   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 38
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 23 2
A down() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of ibrand/laravel-shopping-cart.
5
 *
6
 * (c) iBrand <https://www.ibrand.cc>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
use Illuminate\Database\Migrations\Migration;
13
use Illuminate\Database\Schema\Blueprint;
14
15
class CreateShoppingCartTable extends Migration
16
{
17
    /**
18
     * Run the migrations.
19
     * 单品折扣表.
20
     */
21
    public function up()
22
    {
23
        if (!Schema::hasTable('shopping_cart')) {
24
25
            Schema::create('shopping_cart', function (Blueprint $table) {
26
                $table->string('key');
27
                $table->string('__raw_id');
28
                $table->string('guard')->nullable();
29
                $table->integer('user_id')->nullable();
30
                $table->integer('id');
31
                $table->string('name');
32
                $table->integer('qty');
33
                $table->decimal('price');
34
                $table->decimal('total');
35
                $table->string('__model')->nullable();
36
                $table->string('type')->nullable();
37
                $table->string('status')->nullable();
38
                $table->text('attributes')->nullable();
39
                $table->primary(['key', '__raw_id']);
40
                $table->nullableTimestamps();
41
            });
42
        }
43
    }
44
45
    /**
46
     * Reverse the migrations.
47
     */
48
    public function down()
49
    {
50
        Schema::dropIfExists('shopping_cart');
51
    }
52
}
53