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

CreateTransactionsTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 30
rs 10
c 1
b 0
f 0
wmc 2
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateTransactionsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('transactions', function (Blueprint $table) {
17
            $table->bigIncrements('id');
18
            $table->morphs('holder');
19
            $table->unsignedBigInteger('wallet_id')->comment('钱包 id');
20
            $table->enum('type', ['deposit', 'withdraw'])->index()->comment('交易类型');
21
            $table->bigInteger('amount')->comment('交易数额');
22
            $table->boolean('confirmed')->comment('是否交易完成');
23
            $table->json('meta')->nullable()->comment('交易信息');
24
            $table->uuid('uuid')->unique()->comment('交易 uuid');
25
            $table->timestamps();
26
        });
27
    }
28
29
    /**
30
     * Reverse the migrations.
31
     *
32
     * @return void
33
     */
34
    public function down()
35
    {
36
        Schema::dropIfExists('transactions');
37
    }
38
}
39