ruby on rails - Usefulness of db migrations rollback -


Many people are talking about DB migration, especially about its rollback potential.

I suspect, even if it is absolutely useful, because the schema of the DB and model is tightly linked to Application Logic (MVC).

Suppose I rollback some migration. what else ? The application will not work because its logic is completely dependent on DB.

What is the use of rollback capacity for DB migration?


Update 1

Main question

Why rollback is presented as a feature When do I need to change the code?

I do not no create a migration, such as "add_another_field_to_table" Instead, each migration file describes each table entirely in DB. When I have to change something in my DB, I just change the migration file, but do not roll it back .

In fact, if I rollback the migration, it does not bring me back on time , as the version controls. I have a lot of work when I planned to change Goes and rollback does not give me anything

The issue of rollback is that you can rollback code at the same time and in the DB scenario, If you upgrade your DB to your production server, you get a bug and you really have to go back. Then rollback your code and use your down migration to roll back your DB.


Comments