# Can you do migrations with an allready existing mysql DB?

**URL:** <https://www.ruby-forum.com/t/can-you-do-migrations-with-an-allready-existing-mysql-db/85984>\
**Category:** Rails\
**Created:** [February 18, 2007, 5:57pm UTC](https://www.ruby-forum.com/t/can-you-do-migrations-with-an-allready-existing-mysql-db/85984 "2007-02-18T17:57:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![surfivor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@surfivor](https://www.ruby-forum.com/u/surfivor)\
**Post date:** [February 18, 2007, 5:57pm UTC](https://www.ruby-forum.com/t/can-you-do-migrations-with-an-allready-existing-mysql-db/85984/1 "2007-02-18T17:57:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![surfivor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@surfivor](https://www.ruby-forum.com/u/surfivor)\
**Post date:** [February 18, 2007, 8:20pm UTC](https://www.ruby-forum.com/t/can-you-do-migrations-with-an-allready-existing-mysql-db/85984/2 "2007-02-18T20:20:04Z")

</div>

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...](http://www.greencheese.us/ZeekLand) ← NOT a blog!!!

---

<div class="post-metadata">

**Author:** ![surfivor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@surfivor](https://www.ruby-forum.com/u/surfivor)\
**Post date:** [February 18, 2007, 8:30pm UTC](https://www.ruby-forum.com/t/can-you-do-migrations-with-an-allready-existing-mysql-db/85984/3 "2007-02-18T20:30:05Z")

</div>

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](http://www.manning.com/black))  
(See what readers are saying! [http://www.rubypal.com/r4rrevs.pdf](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](http://www.rubypal.com))

---

<div class="post-metadata">

**Author:** ![surfivor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@surfivor](https://www.ruby-forum.com/u/surfivor)\
**Post date:** [February 18, 2007, 8:40pm UTC](https://www.ruby-forum.com/t/can-you-do-migrations-with-an-allready-existing-mysql-db/85984/4 "2007-02-18T20:40:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![surfivor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@surfivor](https://www.ruby-forum.com/u/surfivor)\
**Post date:** [February 19, 2007, 1:10pm UTC](https://www.ruby-forum.com/t/can-you-do-migrations-with-an-allready-existing-mysql-db/85984/5 "2007-02-19T13:10:33Z")

</div>

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