Let's say I work in git in my Rails application, and I have two branches, each of which has its own migration.
1) branch001 creates a table called tableA using migration 20160101000000_create_table_A
2) branch002 creates a table named tableB using migration 20160101000001_create_table_B
Obviously, a timestamp for the second migration was created after the first.
But let me say that I first branch002 to master first, because it is ready first. My schema file becomes -
ActiveRecord::Schema.define(version: 20160101000001) do .... end
The schema version tells activerecord that it has already been patched to a level / version larger than my first branch.
What happens when I finally get to merge my first branch?
- Will the schema version return in
20160101000000 ? - Will there be any problems associated with the first branch migration because the circuit sees that it is already “patched” and skips it?
- In general, what is the best practice for such things? Should I rename the first branch with a new, newer timestamp?
Thanks!
EDIT -
It is really interesting what I have to do to resolve the merge conflict when I merge the 2nd branch into master . Should I leave it as a later timestamp or return it to an earlier timestamp?
<<<<<<< HEAD (master) ActiveRecord::Schema.define(version: 20160101000001) do ======= ActiveRecord::Schema.define(version: 20160101000000) do >>>>>>> 282cda7... Adding Table B
source share