<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('activity_share_refunds', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->unsigned()->comment("用户id");
            $table->integer('order_id')->unsigned()->comment("订单id");
            $table->integer('target_order_id')->unsigned()->comment("被分享订单id");
            $table->string('trade_no')->nullable()->comment("订单号");
            $table->string('refund_trade_no')->nullable()->comment("退款订单号");
            $table->decimal('total_amount', 7)->default(0)->comment("总金额");
            $table->decimal('amount',7)->default(0)->comment("金额");
            $table->boolean('is_hook')->default(0)->comment("是否回调，0：否，1:是");
            $table->string('err_message')->nullable()->comment("错误信息");
            $table->tinyInteger('status')->default(0)->comment("状态，0：未审核，1：同意，-1：拒绝");
            $table->string("reason")->nullable()->comment("理由");
            $table->string('sub_mch_id')->nullable()->comment("商户id");
            $table->timestamps();
        });
    }

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