Published 4 months ago by ITellMyselfSecrets
I read a lot about Migration and also watched some vides, but I still don't get it why we need it? I am using PHPMyAdmin and that works fine for me. Any good arguments to use migrations?
You can see migrations as the version control for your database. It keeps a record of how your database was created and updated in time. It's also useful if you work with multiple persons. Using migrations you don't have to export databases or describe how to change the columns. Just run the migrations and you're done.
Alternative solutions are keeping a database dump in your project, however if you work with others you could have conflicts.
Yeah, so your schema is in version control along with the rest of your code. Also, if you ever have other people work on it it's a lot easier than having to send the schema around and keep everybody in sync for every change you make. When you're dealing with local dev+testing+production servers, it's a lot easier to keep everything in sync as well and not forget to update something. Once you have a major error, you'll understand ;)
Oh, another thing... migrations can be run automatically as part of your deployment script, so you don't have to manually do anything to the database when using automatic deployment tools. If you don't use migrations, you'd have to manually sync your db changes to all servers.
Like I use laravel forge. All I have to do is push something to my master branch in github and it automatically deploys the code to the servers and runs the migrations.