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

推荐答案

您可以编辑/config/database ase.php文件,搜索mysql个条目并更改:

'engine' => null,

to

'engine' => 'InnoDB',

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

Laravel相关问答推荐

Uncaught ReferenceError:未定义require[Shopify PHP React Browser问题]

如何在 Laravel 中使用多对一变形关系

Laravel where 子句只返回一个数据库条目

在 laravel 中查询此类数据的最佳做法是什么?

mysql 加入 ON 和 AND 到 laravel eloquent

Laravel 5表单请求验证返回禁止错误

磁盘 [视频] 没有配置的驱动程序

Laravel 4:验证前修剪输入的最佳实践

通过单击按钮保存 PhpSpreadSheet

如何创建具有关系的 Eloquent 模型?

如何在没有 Artisan 的情况下运行 Laravel?

如何在 Laravel 5.1 中改变环境?

Laravel - 更新时禁用更新时间

Eloquent - 更新集合中的所有模型

为什么在 Laravel 的 DB::select 中使用 DB::raw?

Laravel Eloquent 模型中的字段

Laravel 如何从子域 URL 中删除api前缀

Laravel/PHPUnit:断言 json 元素存在而不定义值

将参数传递给过滤器 - Laravel 4

Laravel 数据迁移