<?php

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

class CreateUserSignsTable extends Migration
{

    /**
     * Run the migrations.
     * @return void
     */
    public function up()
    {
        Schema::create('user_signs', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->index();
            $table->unsignedInteger('continue_days')->default(0)->comment('连续签到天数');
            $table->unsignedInteger('counts')->default(0)->comment('累计签到天数');
            $table->timestamp('last_sign_at')->nullable();
            $table->tinyInteger('need_case')->default(0)->comment('是否需要上传报告');
            $table->timestamp('reset_at')->nullable()->comment('重置连续次数日期');
            $table->tinyInteger('is_finish')->default(0)->comment('是否完成');
            $table->timestamps();
        });
    }

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

}
