<?php

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

// php artisan  migrate --path=app/database/migrations/fado-migrations

class AddNationalityToBand extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
        $connections = array_keys(Config::get('database.connections'));

        foreach($connections as $connection) {
            try {
                $schemaConnection = Schema::connection($connection);

                $schemaConnection->table('bands', function(Blueprint $table) {
        			$table->string('nationality')->nullable()->default(null);
                });

            } catch (\Exception $e) {
                continue;
            }
        }
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		$connections = array_keys(Config::get('database.connections'));

        foreach($connections as $connection) {
            try {
                $schemaConnection = Schema::connection($connection);

                $schemaConnection->table('bands', function(Blueprint $table) {
                    $table->dropColumn('nationality');
                });
            } catch (\Exception $e) {
                continue;
            }
        }
	}
}
