I had a slightly different situation, it was necessary to add new items, change existing and remove old. This is my example.
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeEnum extends Migration
{
public function up()
{
Schema::table('table_example', function (Blueprint $table) {
DB::statement("ALTER TABLE table_example MODIFY status enum('first', 'second', 'third', 'fourth', 'fifth', 'sixth') NOT NULL;");
DB::statement("UPDATE `field` set `status` = 'fourth' where `status` = 'first';");
DB::statement("UPDATE `field` set `status` = 'fifth' where `status` = 'second';");
DB::statement("ALTER TABLE table_example MODIFY status enum('third', 'fourth', 'fifth', 'sixth') NOT NULL;");
});
}
public function down()
{
Schema::table('table_example', function (Blueprint $table) {
DB::statement("ALTER TABLE table_example MODIFY status enum('first', 'second', 'third', 'fourth', 'fifth', 'sixth') NOT NULL;");
DB::statement("UPDATE `field` set `status` = 'first' where `status` = 'fourth';");
DB::statement("UPDATE `field` set `status` = 'second' where `status` = 'fifth';");
DB::statement("ALTER TABLE table_example MODIFY status enum('first', 'second', 'third',) NOT NULL;");
});
}
}
By the way, generate row SQL query via JetBrains ide(DataGrip), is like that:
∧_∧
(。・ω・。)つ━☆・*。
⊂ ノ ・゜+.
しーJ °。+ *´¨)