Replies: 7 comments 7 replies
-
@pildit I don't think that will make sense like what if the migration is has an dependency on the upcoming migration then it can be a disaster for developer to debug and plus database would be messed up. Keeping all other things in mind I believe that this in the end of the day brings complexity and more errors and depression :) into the developers life then making it easier. But anyways thank you for putting your idea in here. I hope you got your answer. |
Beta Was this translation helpful? Give feedback.
-
What type of errors do you get? Maybe --force would help in your case? |
Beta Was this translation helpful? Give feedback.
-
Same problem here, imported an old dump, wanna run the migration to get N new tables, dont care about all the "table already exist" errors just want laravel to add those that dont exist |
Beta Was this translation helpful? Give feedback.
-
Had to deal with developers above me who would create a migration, and then did the modification manually on production, causing problems with CI. I always told them...check if the table already exists, check if it already has the columns, but they wouldn't or forgot. But I don't think forcing migrations to run anyway is the way to go. at least not in a way that it could be automated. you´d be carefully reviewing every exception. Did it fail because it already exists? or did it fail due some other error... another aproach could be skipping specific migrations, but again, not automatable. |
Beta Was this translation helpful? Give feedback.
-
the workaround would be to specify your migration classes with the |
Beta Was this translation helpful? Give feedback.
-
Usually, Laravel assumes, every migration can technically depend on any previously executed migration. So changing the order temporarily but not keeping a record of it might result in co-workers running into the same problem, something that Laravel strives to avoid. However, before you commit a collection of multiple migrations, you sometimes need to test them and fiddle around with them to make them work. It might just as well be that they are not dependent on other migrations within said collection. To make your proposal work while keeping a record of skipping said migration, I suppose, it would be necessarily to add an option where the files are renamed to appear in a different order. So the failing migration then is moved behind the next migration and so on or straight to the end. The reordered migrations would have to be run again to check if they work now before committing them. |
Beta Was this translation helpful? Give feedback.
-
Hope the following blog will help you with the solution to go with: |
Beta Was this translation helpful? Give feedback.
-
Every time i got a migration error I think about this : why there is not an option to continue-on-failure ?
Beta Was this translation helpful? Give feedback.
All reactions