How do you manage Ruby on Rails migrations with the development team?

We have a development team, each of which will develop database migration for our system using Rails tools. Migrations at first seem like a great way to manage changes in a database schema, but as we go on, it becomes more difficult to manage changes in a distributed way. If each of us independently develops migration, how can we coordinate the problems that arise?

To be specific regarding issues, imagine the following timeline for the scenario:

  • Developer A creates a new migration file with a time stamp of 9:00.
  • Developer B creates another new migration file with a time stamp of 10:00.
  • Developer B checks for migration from 10:00 AM to 11:00 AM.
  • Developer A checks for migration dated 9:00 AM at 11:30 AM.

There are a number of problems that can arise here, especially if both migration files conflict with their changes, but the most basic problem is that some people started the migration at 10:00, when the migration was at 9:00 marked. Timestamps associated with migrations, of course, when the file was created, and not when it was checked, which will ruin the Rails migrator.

This is a fixable problem, but there may be many different options in the solution. What is the best way (or at least a good way) to solve this problem?

+3
source share
2 answers

. , , , A B .

:

  • , . .
  • ( ), . , .

:

  • A 9:00.
  • B 10:00.
  • B . , , 10:00 11:00 .
  • A , , 11:30 (, , 11:35).

, .

+6

. db, , .

, , . , , , .

0

Source: https://habr.com/ru/post/1716839/


All Articles