Can you do migrations with an allready existing mysql DB?

Do you have to use migrations from the beggining, or can you start
with an allready existing DB and build upon it with migrations ?

surfivor wrote:

Do you have to use migrations from the beggining, or can you start
with an allready existing DB and build upon it with migrations ?

Yes.


Phlip
Redirecting... ← NOT a blog!!!

Hi –

On Sun, 18 Feb 2007, surfivor wrote:

Do you have to use migrations from the beggining, or can you start
with an allready existing DB and build upon it with migrations ?

You can use migrations on an existing database. In general, though,
if you use migrations, they really want to be in charge; it’s
error-prone to mix migrations and other database-changing techniques,
because the migration system has its own idea of what level the
database is at and what’s there. So it’s probably best either to
decide to switch entirely to migrations (possibly even dumping the
schema into migration-friendly form and reloading it, though that may
be overkill) or avoid them.

David


Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
(See what readers are saying! http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)

Naturally Yes.

But take a care about the situation when you would like to go back
with db:migrate VERSION = 0.

Perhaps you would like to make the situation where you can go to the
empty database and to be able to build from the scratch with
migrations.

One more thing, kip in mind the same situation has to be met in
production environment.

dima

Check out:
http://weblog.jamisbuck.org/2005/9/27/getting-started-with-activerecord-migrations