stephenjude / filament-blog

A faceless blog content manager with configurable richtext and markdown support for filament admin panel
MIT License
155 stars 37 forks source link

Migration rollback with foreign keys #39

Closed nickhhg closed 1 year ago

nickhhg commented 1 year ago

Filament Blog Version

2

Filament Version

3

Laravel Version

10

Livewire Version

No response

PHP Version

8.2

Problem description

due to the foreign key constraints in the blog_posts table, you cannot reset/rollback the blog tables migration. under mysql8 you will receive the following error

Cannot drop table 'blog_categories' referenced by a foreign key constraint 'blog_posts_blog_category_id_foreign' on table 'blog_posts'

This can be resolved by dropping or disabling the foreign keys within the migration during rollback https://laravel.com/docs/9.x/migrations#dropping-foreign-keys

Expected behavior

rollbacking of blog tables migration actually works without error and blog tables are dropped

Steps to reproduce

composer require stephenjude/filament-blog
php artisan filament-blog:install
php artisan migrate
php artisan migrate:rollback

Reproduction repository

https://github.com

Relevant log output

No response

stephenjude commented 1 year ago

@nickhhg do you mind making a PR for this?

stephenjude commented 1 year ago

This issue has been fixed #40