# Extracting migrations from an existing database

**URL:** <https://www.ruby-forum.com/t/extracting-migrations-from-an-existing-database/126884>\
**Category:** Rails\
**Created:** [January 23, 2008, 2:19am UTC](https://www.ruby-forum.com/t/extracting-migrations-from-an-existing-database/126884 "2008-01-23T02:19:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/2bfe46/32.png) [@bhus](https://www.ruby-forum.com/u/bhus)\
**Post date:** [January 23, 2008, 2:19am UTC](https://www.ruby-forum.com/t/extracting-migrations-from-an-existing-database/126884/1 "2008-01-23T02:19:04Z")

</div>

Hello,

Let me say as a precursor that I am an eternal newbie, so please  
pardon my ignorance. I did briefly look around in the forums to see if  
this topic had already been covered, but could not find it. I would be  
quite willing to have someone point me to the proper place if it has  
already been covered.

My query is this : I was wondering if there is any way to create a set  
of migrations for an existing database – to generate a basic  
migration from all of the tables (or even one at a time) in the  
database. My situation is : I am creating a new web interface for an  
existing ( pre-Rails 🙂 ) database, but would like to be able to  
recreate the table structure (no data necessary) in a test  
environment. Is there an elegant, established way of doing this?

Thanks for your time.

/Brad.

---

<div class="post-metadata">

**Author:** ![bhus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/2bfe46/32.png) [@bhus](https://www.ruby-forum.com/u/bhus)\
**Post date:** [January 23, 2008, 2:24am UTC](https://www.ruby-forum.com/t/extracting-migrations-from-an-existing-database/126884/2 "2008-01-23T02:24:20Z")

</div>

Try out rake db:schema:dump

On Jan 23, 2008 11:48 AM, bhus [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> of migrations for an existing database – to generate a basic

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

Feel free to add me to MSN and/or GTalk as this email.

---

<div class="post-metadata">

**Author:** ![bhus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/2bfe46/32.png) [@bhus](https://www.ruby-forum.com/u/bhus)\
**Post date:** [January 23, 2008, 4:13am UTC](https://www.ruby-forum.com/t/extracting-migrations-from-an-existing-database/126884/3 "2008-01-23T04:13:40Z")

</div>

gracias
