Does someone have a good way to avoid numbering collisions when
generating migrations in multiple source repositories? For example, I’m
working on my copy of the site, and my co-worker is working on his copy
of the site. We both need to make a migration, and they both end up
having the same number, say 007_add_user_table.rb
Does someone have a good way to avoid numbering collisions when
generating migrations in multiple source repositories? For example, I’m
working on my copy of the site, and my co-worker is working on his copy
of the site. We both need to make a migration, and they both end up
having the same number, say 007_add_user_table.rb
Is there some technique to avoid this?
(I’m sort of assuming you’re using Subversion – if you’re not, you
should. I’m also assuming you don’t really have “multiple source
repositories” – if you each have your own repository, all bets are
off:-)
I can’t think of one, except that you should make it a rule to update
your source tree immediately before adding a migration and commit your
changes immediately after. If both migrations have the same name, you
should get a conflict. If happen to end up with two different migrations
with different names, but the same number, you could just do ‘svn rename
007_add_user_table.rb 008_add_user_table.rb’
Thanks. I think that’s a very good solution. I’m not using SVN, I’m
using Mercurial, btw. I just like it because it’s distributed and I
don’t have to keep a server running to use it.
-Adam
Al Evans wrote:
Adam T. wrote:
Does someone have a good way to avoid numbering collisions when
generating migrations in multiple source repositories? For example, I’m
working on my copy of the site, and my co-worker is working on his copy
of the site. We both need to make a migration, and they both end up
having the same number, say 007_add_user_table.rb
Is there some technique to avoid this?
(I’m sort of assuming you’re using Subversion – if you’re not, you
should. I’m also assuming you don’t really have “multiple source
repositories” – if you each have your own repository, all bets are
off:-)
I can’t think of one, except that you should make it a rule to update
your source tree immediately before adding a migration and commit your
changes immediately after. If both migrations have the same name, you
should get a conflict. If happen to end up with two different migrations
with different names, but the same number, you could just do ‘svn rename
007_add_user_table.rb 008_add_user_table.rb’
–Al Evans
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.