did you try to change the name of the files in migrations folder, cause it appear that order of those files depend on the date , try to edit the date on files maybe that will fix your problem
a question about migration
Hello there, Now I have a question like this, I hope I can express myself. I am using Laravel 8. Let me explain through this example; There is User and Post migration. The post model should contain the "user_id" field as it is. Now the problem is 1- php artisan make: model Post -m 2- php artisan make: model User -m
If I create the commands in the above order, the command "php artisan migrate" will show me an error, the error is likely to look like this:
"relation" users "does not exist (SQL: alter table" posts "add constraint" posts_user_id_foreign "foreign key (" user_id ") references" users "(" id ") on delete cascade)"
In fact, if I created the User model before the Post model, there would be no problem. When I want to create a new table while I am progressing in the project, I encounter such problems, in this case I need to delete the migration file with foreign keys and create it again. How can I get rid of it. How can I make it work without deleting the files again?
Please or to participate in this conversation.