Using migrations to delete table with foreign key

后端 未结 7 914
不思量自难忘°
不思量自难忘° 2020-12-24 06:25

Im trying to roll back my migrations.

My migrations file uses foreign keys like so

$table->foreign(\'user_one\')->references(\'id\')->on(\'u         


        
7条回答
  •  臣服心动
    2020-12-24 06:38

    pm_convo_replys has a foreign key that references pm_convo, thus you cannot delete pm_convo first without violating a foreign key constraint in pm_convo_replys.

    To delete both you need to delete pm_convo_replys first.

    public function down()
    {
        Schema::drop('pm_convo_replys');
        Schema::drop('pm_convo');
    }
    

提交回复
热议问题