Passed
Push — master ( 23ae9b...38cc9b )
by Moecasts
05:37
created

CreateTransfersTable::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 13
nc 1
nop 0
dl 0
loc 15
rs 9.8333
c 1
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 CreateTransfersTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('transfers', function (Blueprint $table) {
17
            $table->bigIncrements('id');
18
            $table->morphs('from');
19
            $table->unsignedBigInteger('from_wallet_id');
20
            $table->string('action')->comment('操作行为:read/download/subscribe/trial 等');
21
            $table->morphs('to');
22
            $table->unsignedBigInteger('to_wallet_id');
23
            $table->bigInteger('fee')->defalut(0)->comment('手续费');
24
            $table->unsignedBigInteger('deposit_id')->comment('收款事务 id');
25
            $table->unsignedBigInteger('withdraw_id')->comment('付款事务 id');
26
            $table->uuid('uuid')->unique();
27
            $table->boolean('refund')->default(false)->comment('交易是否完成');
28
            $table->timestamps();
29
        });
30
    }
31
32
    /**
33
     * Reverse the migrations.
34
     *
35
     * @return void
36
     */
37
    public function down()
38
    {
39
        Schema::dropIfExists('transfers');
40
    }
41
}
42