Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我必须将批量数据插入表中并将外键约束检查推迟到事务提交。
与 postgresql 一样,NOT DEFERRABLE 是默认约束类型(mysql innoDB根本不支持DEFERRABLE 约束),我如何在迁移中更改此默认值?
NOT DEFERRABLE
您始终可以使用DB::raw('...'). 这应该可以解决问题:
DB::raw('...')
DB::raw('SET foreign_key_checks = 0;');
http://laravel.com/docs/queries