<?php

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

class CreateEsiScopes extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if(!Schema::hasTable('EsiScopes')) {
            Schema::create('EsiScopes', function(Blueprint $table) {
                $table->increments('id');
                $table->integer('character_id');
                $table->foreign('character_id')->references('character_id')->on('EsiTokens');
                $table->string('scope');
                $table->timestamps();
            });
        }
    }

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