Forum: Ruby on Rails Does rake db:migrate protect against concurrent use?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Paul L. (Guest)
on 2009-04-17 02:09
(Received via mailing list)
If two people go to the same rails application (same directory) and
both run "rake db:migrate" to update the database with a set of
migrations (the same ones) at the same time, is it likely that bad
things will happen to the data, or will db:migrate do something to
prevent the same migration from being run by more than one
(simultaneous) process?

Thanks,
   --Paul
Phlip (Guest)
on 2009-04-17 02:51
(Received via mailing list)
> If two people go to the same rails application (same directory) and
> both run "rake db:migrate" to update the database with a set of
> migrations (the same ones) at the same time, is it likely that bad
> things will happen to the data, or will db:migrate do something to
> prevent the same migration from being run by more than one
> (simultaneous) process?

rake db:migrate is only tuned for one development workstation.

Are you implying your developers don't have individual databases?

In my experience running various rake commands accidentally at the same
time, one batch will "win", and the other will cough up a zillion errors
and
expire gracelessly...
Matt J. (Guest)
on 2009-04-19 01:52
(Received via mailing list)
Depending on your DB, it may support transactional migrations (as of
Rails 2.2). That should ensure that only one set of changes go
through. Haven't ever tried it, but it should probably work.

--Matt J.
This topic is locked and can not be replied to.