Prior to MySQL 5.6+, the InnoDB table type does not support full-text search. To update the version of MySQL on the server is not possible, but full-text search is required.

How to change the type of an existing table from InnoDB to MyISAM without data loss in Laravel Migration?

    1 answer 1

    Standard methods of Laravel migrations will not change the type of the table. But, this can be done by running the following query: ALTER TABLE my_table ENGINE = MyISAM .

    Before changing the table type, you need to delete all foreign keys in this table, as well as all referencing foreign keys from other tables to this one.

    Migration example:

     use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; use Illuminate\Support\Facades\DB; class UpdateUsersProfileSetTableEngineMyisam extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::table('users_profile', function (Blueprint $table) { $table->dropForeign('users_profile_user_id_foreign'); }); DB::statement('ALTER TABLE users_profile ENGINE = MyISAM'); } /** * Reverse the migrations. * * @return void */ public function down() { DB::statement('ALTER TABLE users_profile ENGINE = InnoDB'); Schema::table('users_profile', function (Blueprint $table) { $table->foreign('user_id')->references('id')->on('users'); }); } } 

    This method is also suitable for reverse changing the type of table with MyISAM -> InnoDB .