<?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('orders', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->unsigned();
            $table->enum('type', ['SERVICE', "TEMP"])->comment('订单类型');
            $table->integer('type_id')->comment("类型id")->unsigned();
            $table->decimal('price', 7,2);
            $table->enum('pay_status', ['UNPAID', 'PAID'])->default("UNPAID")->comment("支付状态");
            $table->string('trade_no', 50);
            $table->string("name")->nullable();
            $table->string('mobile')->nullable();
            $table->string('desc')->nullable();
            $table->enum('status', ['NOTSTART', 'STARTING', 'FINISHED'])->default('NOTSTART')->comment("订单状态");
            $table->boolean('is_hook')->default(0);
            $table->string('err_msg')->nullable();
            $table->timestamps();
        });
    }

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