Total Complexity | 2 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
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 | } |
||
39 |