<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePaymentRedpacksTable extends Migration
{

    /**
     * Run the migrations.
     * @return void
     */
    public function up()
    {
        Schema::create('payment_redpacks', function (Blueprint $table) {
            $table->id();
            $table->boolean('type')->default(0)->index()->comment('0:普通红包，1:裂变红包');
            $table->uuid('redpack_no')->comment('商户订单号')->index();
            $table->decimal('amount')->comment('发放金额');
            $table->unsignedTinyInteger('number')->default(1)->comment('总发放个数');
            $table->enum('driver', ['alipay', 'wechat'])->index()->comment('付款渠道');
            $table->string('to')->index()->comment('用户OPENID');
            $table->string('status', 16)->nullable()->comment('发放状态');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('payment_redpacks');
    }

}
