Answer the question
In order to leave comments, you need to log in
How to update the database structure on a production server?
How to update the database structure on a production server? Now all creations/deletions/changes of tables, columns, etc. performed manually using SSMS. How is versioned database migration organized?
Answer the question
In order to leave comments, you need to log in
Yes, migrations, that's right. Look towards Flyway or Liquibase . I didn’t use the second one, I just read it, so I’ll briefly talk about Flyway. It is free in basic functionality, and it is quite enough.
Migrations are SQL files named according to certain rules, with a version and a short description. Personally, I use the current date and time instead of the abstract version. For example, V20210601_1200__init.sql or V20210602_1015__alter_products.sql. It's boring to create files manually, I wrote a batch file. Using a datetime allows multiple developers to create independent migrations in parallel and not have to pay too much attention to their order. Everything is in the version control repository along with the rest of the project.
When updating the code branch (on the bench or on the prod), we run flyway migrate. It checks the contents of the subdirectory with migrations against its service table. New migrations are applied in turn. Unfortunately, there is no way to roll back a migration like in Yii or Rails frameworks.
Briefly, the work looks like this:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question