Sitepose
Sitepose

Reputation: 322

Why Relational tables via Laravel migrations created with MyISAM which don't support relational features

I noticed, Laravel creates tables via storage engine as MyISAM which does not support relational features.

I have setup the foreign keys via migrations but when I checked in Phpmyadmin, it shows no relational features due to storage engine being MyISAM.

I have read that if I change to InnoDB the relationships can be applied.

But my question is if I cannot add relationships, then why Laravel took that storage engine as MyISAM ? Is there no need to put relationships in database ?? That would make my database vulnerable.

What is the best practice as per Laravel ?

Upvotes: 0

Views: 495

Answers (1)

Ayokunle Akinboboye
Ayokunle Akinboboye

Reputation: 46

Actually, it was not necessarily Laravel that made the database tables MyISAM. If you do not specify it, the tables will be created using the default storage engine of your MySQL version/installation. In your case it was probably MyISAM. To ensure InnoDB is used, edit your config/database.php file and set 'engine' => 'InnoDB',

Upvotes: 0

Related Questions