# Creating Migration Files From MySQL

**URL:** <https://www.ruby-forum.com/t/creating-migration-files-from-mysql/72264>\
**Category:** Rails\
**Created:** [October 16, 2006, 3:31am UTC](https://www.ruby-forum.com/t/creating-migration-files-from-mysql/72264 "2006-10-16T03:31:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daborg69](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d9b06d/32.png) [@daborg69](https://www.ruby-forum.com/u/daborg69)\
**Post date:** [October 16, 2006, 3:31am UTC](https://www.ruby-forum.com/t/creating-migration-files-from-mysql/72264/1 "2006-10-16T03:31:09Z")

</div>

Hey,

I have an application running and I have been creating and editing the  
table through my mysql interface up till now.

I want to create my migration files based on my MySQL tables but I have  
so many tables it would take a long time to do it manually.

Is there anyway to generate migration files based on existing MySQL  
tables?

Thanks for the help.

---

<div class="post-metadata">

**Author:** ![daborg69](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d9b06d/32.png) [@daborg69](https://www.ruby-forum.com/u/daborg69)\
**Post date:** [October 16, 2006, 3:41am UTC](https://www.ruby-forum.com/t/creating-migration-files-from-mysql/72264/2 "2006-10-16T03:41:48Z")

</div>

On Oct 15, 9:31 pm, Scott H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Thanks for the help.
> 
> –  
> Posted viahttp://www.ruby-forum.com/.

There is an ‘extract fixtures’ rake task described in the rails recipes  
book that can write your current data to a series of YAML files. That  
may help some.

\_Kevin

---

<div class="post-metadata">

**Author:** ![daborg69](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/d9b06d/32.png) [@daborg69](https://www.ruby-forum.com/u/daborg69)\
**Post date:** [October 16, 2006, 3:41am UTC](https://www.ruby-forum.com/t/creating-migration-files-from-mysql/72264/3 "2006-10-16T03:41:54Z")

</div>

rake db:schema:dump

Will create /db/shema.rb with your entire database  
migration schema.

You should look into how migrations work - if you make your changes  
through migrations, you’ll have a versionable history of those changes,  
versus having nothing when you just make the changes in your tool. There  
was a post in the last couple weeks discussing migrations in detail.

c.

Scott H. wrote:

> Hey,
> 
> I have an application running and I have been creating and editing the  
> table through my mysql interface up till now.
> 
> I want to create my migration files based on my MySQL tables but I have  
> so many tables it would take a long time to do it manually.
> 
> Is there anyway to generate migration files based on existing MySQL  
> tables?
> 
> Thanks for the help.
