Does rake db:migrate protect against concurrent use?

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

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…

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.