<?php namespace GermanAirlinesVa\Graphql\Updates;

use DB;
use Schema;
use October\Rain\Database\Updates\Migration;

class BuilderTableCreateGermanAirlinesVaGraphqlGraphqlKeys extends Migration
{
  public function up()
  {
    Schema::connection('germanairlinesva_graphql')->create('graphql_keys', function ($table) {
      $table->engine = 'InnoDB';
      $table->bigIncrements('id')->unsigned();
      $table->bigInteger('member_id')->unsigned();
      $table->datetime('valid_from')->default(DB::raw('NOW()'));
      $table->string('key');
    });
  }

  public function down()
  {
    Schema::connection('germanairlinesva_graphql')->disableForeignKeyConstraints();
    Schema::connection('germanairlinesva_graphql')->dropIfExists('graphql_keys');
    Schema::connection('germanairlinesva_graphql')->enableForeignKeyConstraints();
  }
}
