“General error: 1005 Can't create table” Using Laravel Schema Build and Foreign Keys

后端 未结 11 1135
予麋鹿
予麋鹿 2020-12-03 07:02

Essentially, I am having the same issue as this guy, minus the table prefix. Because I have no table prefix, his fix does not work. http://forums.laravel.com/viewtopic.php?i

11条回答
  •  隐瞒了意图╮
    2020-12-03 07:27

    Easiest way is to disable foreign key checks:

    DB::statement('set foreign_key_checks=0');
    
    Schema::table( ... );
    
    DB::statement('set foreign_key_checks=1');
    

提交回复
热议问题