<?php

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

class UpdateCountriIdFieldInStatesCitiesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('states_cities', function (Blueprint $table) {
            DB::statement("UPDATE states SET states.country_id = '99' where states.country_id = '101'");
            DB::statement("UPDATE cities SET cities.country_id = '99' where cities.country_id = '101'");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('states_cities', function (Blueprint $table) {
            DB::statement("UPDATE states SET states.country_id = '101' where states.country_id = '99'");
            DB::statement("UPDATE cities SET cities.country_id = '101' where cities.country_id = '99'");
        });
    }
}
