MySQL Innodb Engine in Laravel

Mysql InnoDB engine in Laravel

You can edit your /config/database.php file, search for mysql entry and change:

'engine' => null,

to

'engine' => 'InnoDB',

This saves you from adding $table->engine = "InnoDB"; for each of your Schemas ;)

How do you set default engine for the Schema Builder?

I don't think it is,the docs http://laravel.com/docs/schema#storage-engines. Can't find any other mentioning of db engine in the docs.

You would expect it to be possible in app/config/database.php

Laravel migrations won't apply on MySQL (InnoDB)

The problem was in fact with the way I wrote my migrations, if someone else has this problem, you can find a good awnser here: laravel-8-foreign-key

Thank you @brombeer for helping me !

Model::Create() method not inserting with InnoDB storage engine

When using InnoDB, you need to know at least a little about "transactions".

If you have autocommit=ON, each statement (such as INSERT) will be a transaction unto itself and will be automatically COMMITTed.

If you have autocommit=OFF, you must eventually issue COMMIT. This is because the statements (INSERTs, etc) are being collected in a "transaction".

The latter case fits the symptoms.

Laravel Schema Builder alter storage engine

Since @alexrussell confirmed my believe, I'm almost certain you can only define the storage engine when you create the table with Schema::create().

However you can always use raw SQL as a last resort:

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

Which database engine type should be specified for Microsoft SQL Database in Laravel?

The concept of "database engine" or "storage engine" is quite specific to MySQL; most database systems have a single back end which everything is built on. There are sometimes special types of database or table for specialist circumstances - e.g. adapters for importing data from other systems, or column-oriented stores for analysing large data sets - but they're rarely encountered.

For Microsoft SQL Server, there really isn't an equivalent option you need to specify. There may be other options you can set about how to configure the table for performance, but I would expect the ORM choose reasonable defaults and there isn't a single parameter with lots of tradeoffs like changing a MySQL engine.



Related Topics



Leave a reply



Submit