<?php namespace GermanAirlinesVa\GraphQl\Updates;

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

class BuilderTableCreateGermanAirlinesVaGraphQlDeferredBindings extends Migration
{
  public function up()
  {
    Schema::connection('germanairlinesva_graphql')->create('deferred_bindings', function ($table) {
      $table->engine = 'InnoDB';
      $table->increments('id')->unsigned();
      $table->string('master_type');
      $table->string('master_field');
      $table->string('slave_type');
      $table->integer('slave_id');
      $table->mediumText('pivot_data')->nullable();
      $table->string('session_key');
      $table->boolean('is_bind')->default(true);
      $table->timestamps();
    });
  }

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