Laravel 5.1 Migration and Seeding Cannot truncate a table referenced in a foreign key constraint

前端 未结 9 2162
借酒劲吻你
借酒劲吻你 2020-12-15 05:04

I\'m trying to run the migration (see below) and seed the database, but when I run

php artisan migrate --seed

I get this error:

<         


        
9条回答
  •  甜味超标
    2020-12-15 05:17

    you can use

    DB::table('your_table_name')->delete();
    

    to empty a table, this won't delete the table structure. But the auto increment id will not start from initial number.

提交回复
热议问题