rtconner / laravel-tagging

Tag support for Laravel Eloquent models - Taggable Trait
MIT License
882 stars 168 forks source link

Can't drop foreign key index on Migration rollback #122

Closed nkeena closed 5 years ago

nkeena commented 8 years ago

I encountered a foreign key constraint error when trying to roll back my database migration.

In case anyone encountered this problem too, I fixed it by adding the following to the _update_tags_table.php migration file:

public function down()
    {
        Schema::disableForeignKeyConstraints();
        Schema::table('tagging_tags', function ($table) {
            $table->dropForeign('tagging_tags_tag_group_id_foreign');
            $table->dropColumn('tag_group_id');
        });
    }

You might want to update the package with these new lines to avoid the error.

rtconner commented 5 years ago

Thank you, added.

vnsc16 commented 2 years ago

I deleted my database, but because I can't find another way to solve this problem. Anyway, this is a solution for me. Thanks