Reputation: 390
I hace deleted some migration files. but when i execute php artisan migrate command, error in the old migration file is showing.
[Illuminate\Database\QueryException]
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL : alter tablecushbu_notifications
add constraintcushbu_notifications_art_id_foreign
foreign key (art_id
) referencescushbu_arts
(id
) on de lete cascade)
Now i don't have migration file for cushbu_notifications, instead i created a new migration file for cushbu_user_notifications.I deleted the cushbu_notifications table from database, also the corresponding entry from migrations table.
Upvotes: 2
Views: 2819
Reputation: 49
Deleting migration files manually will not remove them from the Laravel cache. You can remove them by executing this.
php artisan optimize
Upvotes: 1
Reputation: 928
After manually deleting migration files, clear cache by below command, and then migrate
php artisan cache:clear
then
php artisan migrate
Upvotes: 5
Reputation: 905
remove the entry from the migration table. and also remove references if that used in another migrations file.
Upvotes: 1