1

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.

Geethu
  • 348
  • 6
  • 24

3 Answers3

3

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

php artisan cache:clear

then

php artisan migrate
Gaurav Rai
  • 900
  • 10
  • 23
1

remove the entry from the migration table. and also remove references if that used in another migrations file.

Vishal Varshney
  • 905
  • 6
  • 11
1

Deleting migration files manually will not remove them from the Laravel cache. You can remove them by executing this.

php artisan optimize