I need to add a new table to my database but realised if i run migrations again it will need to rollback and delete everything to be able to run them again,
No it does not. unless you edited your old migrations you already ran on the server, which will change the order of how changes to the db are applied.
Migrations are applied to the database sequentially. So let's say in migration1 you create a table with 4 fields: then ran artisan migrate. And in migration2 you added an email field. and in the 3rd you changed the field email to email_address, when you run artisan migrate these migrations are applied one by one and if you have written the proper rollback statements the db should roll back correctly.
If more than one migration file was executed on the single artisan migrate command both of them will rollback once you run artisan rollback.
@GoodBytesUK - On standard machines without a deployment script running php artisan migrate will only run migrations which haven't been run yet. Basiaclly, it will run migration files which are not in the database table called migrations of your server.
However, I find that with using Envoy, it always deletes the existing migrations which is great for development deploys but not good for production. Does anyone know how this can be changed. I simply have a hood to run migrations and then seed but it does roll them back before hand without me instructing so?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community