<?php

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

class CreateTasksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tasks', function (Blueprint $table) {
            $table->increments('id');
            # 用户id
            $table->integer('user_id')->default('0');
            $table->text('prompt');
            $table->text('prompt_img')->nullable();
            $table->integer('type')->default('1');
            $table->integer('status')->default('0');
            $table->integer('prompt_num')->default('1');
            # gpt指令生成是否成功
            $table->integer('gpt_status')->default('0');
            # 任务失败原因
            $table->text('message')->nullable();
            $table->timestamps();
        });
    }

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