2022_01_12_072821_create_order_table.php 1.63 KB
<?php

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

class CreateOrderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order', function (Blueprint $table) {
            $table->increments('id');
            $table->string('order_sn')->index()->default('')->comment('订单号');
            $table->unsignedBigInteger('user_id')->index()->comment('用户id');
            $table->string('description')->default('')->comment('订单描述');
            $table->string('thumbnail')->default('')->comment('缩略图');
            $table->decimal('pay_amount')->comment('实付金额');
            $table->decimal('goods_amount')->comment('商品金额');
            $table->unsignedSmallInteger('status')->comment('订单状态:100待付款 101用户取消 102超时取消 103商户取消 201已付款 204已完成');
            $table->timestamp('cancel_time')->nullable()->comment('关闭时间');
            $table->string('source')->comment('来源');
            $table->string('pay_number')->default('')->comment('支付交易号');
            $table->string('pay_type')->default('')->comment('支付类型');
            $table->string('callback')->default('')->comment('回调参数');
            $table->timestamp('pay_time')->nullable()->comment('支付时间');
            $table->timestamps();
        });
    }

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