<?php

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

class CreateActivitiesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('activities', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title');
            $table->bigInteger('user_id')->index();
            $table->string('code')->index();
            $table->tinyInteger('type')->comment('1 延期券 2固定有效期');
            $table->tinyInteger('status')->comment('1 正常 0关闭');
            $table->integer('days')->comment('延期券 延期时间');
            $table->integer('full')->comment('满足金额');
            $table->integer('take')->comment('减去金额');
            $table->timestamp('start_at')->comment('开始时间');
            $table->timestamp('end_at')->comment('结束时间');
            $table->timestamps();
        });
    }

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