<?php

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

class CreateTasksTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tasks', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('category_id')->default(0)->index();
            $table->string('title', 100)->nullable()->comment('任务标题');
            $table->string('sub_title')->nullable()->comment('副标题');
            $table->string('key', 100)->nullable()->comment('任务标识');
            $table->string('ico', 200)->nullable()->comment('任务图标');
            $table->string('cover')->nullable()->comment('图片');
            $table->integer('position')->default(0)->comment('定位');
            $table->json('identity')->nullable()->comment('可用身份');
            $table->string('remark', 100)->nullable()->comment('任务描述');
            $table->string('tips', 100)->nullable()->comment('任务奖励提示');
            $table->text('description')->nullable()->comment('任务详细说明');
            $table->string('url', 200)->nullable()->comment('任务目标连接');
            $table->integer('rule_id')->nullable()->comment('对应账变规则');
            $table->decimal('rule_number', 8, 2)->default(0)->comment('任务发放的数值');
            $table->string('type', 20)->nullable()->comment('任务计量类型');
            $table->unsignedInteger('task_number')->default(0)->comment('任务数额');
            $table->boolean('company_certify')->nullable()->comment('是否企业认证');
            $table->string('cycle', 20)->nullable()->comment('周期');
            $table->boolean('status')->default(0)->comment('状态');
            $table->timestamps();
        });
    }

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

}
