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.