Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel & InnoDB

I am using laravel and laravel migration mechanism. I created tables and seted up foreign keys. But the tables are MyISSAM so no foreign keys are created. Where do I enable / configure this? (to change it to InnoDB and not in the mysql server).

like image 712
DigitalWM Avatar asked Jul 06 '12 08:07

DigitalWM


People also ask

What is Laravel used for?

Laravel Philosophy Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching. Laravel aims to make the development process a pleasing one for the developer without sacrificing application functionality.

Is Laravel frontend or backend?

Laravel is a backend framework that provides all of the features you need to build modern web applications, such as routing, validation, caching, queues, file storage, and more.

Is Laravel better than PHP?

Conclusion. PHP vs Laravel are both well-suited frameworks for building PHP based web apps with effective solutions. With PHP, the development solutions might comparatively be more straightforward, and on the other hand, Laravel offers more variety in terms of tools and resources, making it reliable.

Which is better Django or Laravel?

Django comes out on top in terms of speed (thanks in part to the faster Python), scalability and maintenance. Its built-in tools include decorators, SEO tools and third-party libraries. Laravel, on the other hand, is easier to use thanks to its simpler features, and contains strategy infusion as well.


2 Answers

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 ;)

like image 120
Thomas LAURENT Avatar answered Sep 28 '22 01:09

Thomas LAURENT


Define engine like this

  Schema::create("models", function(Blueprint $table) {             $table->engine = "InnoDB";   } 
like image 43
srsajid Avatar answered Sep 28 '22 00:09

srsajid