Laravel Schema Builder changes storage engine

I am trying to modify a table and change its storage engine on InnoDb . When I run php artisan migrate , it exits without errors. However, when I test the storage engine in Sequel Pro, nothing changes.

 public function up() { Schema::table('tests', function(Blueprint $t) { $t->engine = 'InnoDB'; $t->foreign('group_id')->references('id')->on('test_groups')->onDelete('restrict'); }); } 
+6
source share
1 answer

Since @alexrussell has confirmed his faith, I am pretty sure that you can only determine the storage mechanism when creating a table using Schema::create() .
However, you can always use raw SQL as a last resort:

 DB::statement('ALTER TABLE tests ENGINE = InnoDB'); 
+10
source

Source: https://habr.com/ru/post/979684/


All Articles