Search code examples
laravellaravel-5.4database-migrationlaravel-artisan

Deleted migration files getting executed : Laravel application


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 table cushbu_notifications add constraint cushbu_notifications_art_id_foreign foreign key (art_id) references cushbu_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.


Solution

  • After manually deleting migration files, clear cache by below command, and then migrate

    php artisan cache:clear
    

    then

    php artisan migrate