Database versioning with the migrations system In Laravel

Until this point, we worked with the Schema class using some simple routes. Quite easy, but it’s not a very good practice. You know: the single responsibility principle is not just a bedtime story.

Also, it’s not just about the code: the database too should have a fully functional version control system in order to keep track of all the updates and facilitate a new member in your team.

Well, the migrations system is here to help. You can see it as a version control system for your database, which is made up of many files. Every single one of these files is a class with the two methods: up() and down(). In the up() method, you will put all of your database construction logic. In the down() method, instead, you will put anything related to rolling back what you did in the up() method.

About the author

Deven Rathore

I'm Deven Rathore, a multidisciplinary & self-taught designer with 3 years of experience. I'm passionate about technology, music, coffee, traveling and everything visually stimulating. Constantly learning and experiencing new things.

Pin It on Pinterest

Shares

Get the best in web dev

Join dunebook.com and recieve best in web dev , once a week FREE

An email has been Sent to your Inbox ! Please Confirm your Subscription :)