<?php

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

/**
 * Migration auto-generated by Sequel Pro Laravel Export
 * @see https://github.com/cviebrock/sequel-pro-laravel-export
 */
class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_info', function (Blueprint $table) {
            $table->increments('id');
            $table->string('code', 50)->comment('订单流水号');
            $table->string('transaction_id', 255)->nullable()->comment('交易流水号');
            $table->unsignedInteger('user_id')->comment('用户id');
            $table->unsignedInteger('goods_id')->default(1)->comment('商品id：1梦想币');
            $table->unsignedInteger('price')->default(1)->comment('商品单价');
            $table->unsignedInteger('number')->default(1)->comment('商品数量');
            $table->unsignedInteger('amount')->comment('交易金额');
            $table->tinyInteger('pay_type')->default(1)->comment('支付类型，1：支付宝，2：微信支付，3：银联卡');
            $table->tinyInteger('status')->comment('订单状态：0,待处理，1,已完成，2,已取消');
            $table->string('ext_info', 255)->nullable();
            $table->nullableTimestamps();

            $table->index('code', 'idx_code');
            $table->index('transaction_id', 'idx_tid');
            $table->index('user_id', 'idx_user');

            

        });
    }

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