A table that should exist in all projects with a database

It’s called schema_version (or migrations, or whatever suits you) and its purpose is to keep track of structural or data changes to the database.

Whether you add this table from the beginning of the project or just after you’ve deployed the first version to a staging or production server is up to you.

Whenever you need to execute an SQL script to change the database structure or perform a data migration you should be adding a row in that table as well. And do that via an insert statement at the beginning or end of that script (which is committed to the project’s code repository).

Read more


Leave a comment

Your comment