renameColumn migration fails for existing column with columns does not exist error



PHP Snippet 1:

public function up()
    {
        Schema::table('class_rooms', function (Blueprint $table) {
            $table->integer('price')->change();
            $table->renameColumn('price', 'cost_subscribed');
            //  $table->bigInteger('price')->change(); //->optional
        });
    }

PHP Snippet 2:

class RenamePriceClassRoomsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasColumn('class_rooms', 'price')) {
            Schema::table('class_rooms', function (Blueprint $table) {
                $table->renameColumn('price', 'cost_subscribed');
            });
        } else {
           Schema::table('class_rooms', function($table) {
               $table->integer('price')->after('<some_column>');
           });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('class_rooms', function (Blueprint $table) {
            //
        });
    }
}

PHP Snippet 3:

Schema::table('class_rooms', function($table) {
       $table->integer('cost_subscribed')->after('<some_column>');
   });
   if (Schema::hasColumn('class_rooms', 'price')) {
        Schema::table('class_rooms', function (Blueprint $table) {
            $table->dropColumn('price');
        });
    }

PHP Snippet 4:

Updating a row on an updatable ResultSet with a BigInteger object on an UNSIGNED INT fails. A MysqlDataTruncation is throwned when updateRow() is executed.

PHP Snippet 5:

composer require doctrine/dbal

PHP Snippet 6:

class RenamePriceClassRoomsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('class_rooms', function (Blueprint $table) {
            $table->renameColumn('price', 'cost_subscribed');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('class_rooms', function (Blueprint $table) {
            $table->renameColumn('cost_subscribed','price');
        });
    }
}