<<?php

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

class CreateApiAccessTokenTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('api_access_token', function (Blueprint $table) {
                $table->bigIncrements('id');
                $table->string('token','64')->unique();
                $table->integer('expire_date');
                $table->unsignedInteger('user_id');
                $table->tinyInteger('invalidate');
                $table->integer('created_at');
                $table->integer('updated_at');
            });

        Schema::table('api_access_token',function (Blueprint $table) {
            $table->foreign('user_id')->references('id')->on('user');
        });
    }

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