<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Ruby on Rails Notes &#187; migration</title> <atom:link href="http://railsnotes.com/tag/migration/feed/" rel="self" type="application/rss+xml" /><link>http://railsnotes.com</link> <description>A code-heavy brain dump of stuff I come across working on Ruby on Rails projects including Models, ActiveRecord, Views, Controllers, RESTful rails, deployment, server stuff, etc.</description> <lastBuildDate>Sun, 29 Aug 2010 23:45:16 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.1</generator> <item><title>Turning an existing database to a rails migration</title><link>http://railsnotes.com/97-turning-an-existing-database-to-a-rails-migration/</link> <comments>http://railsnotes.com/97-turning-an-existing-database-to-a-rails-migration/#comments</comments> <pubDate>Wed, 25 Feb 2009 07:23:02 +0000</pubDate> <dc:creator>Melvin Ram</dc:creator> <category><![CDATA[deployment]]></category> <category><![CDATA[database]]></category> <category><![CDATA[migration]]></category> <category><![CDATA[server]]></category><guid
isPermaLink="false">http://railsnotes.wordpress.com/?p=97</guid> <description><![CDATA[Q: Is there a way to make a migration from an existing database? A. Yes, but you need to be more specific with this question because there are two ways. The first approach will dump the schema of your existing database into a migration. The second will dump the data as well. Why would you want [...]]]></description> <content:encoded><![CDATA[<p></p><p>Q: Is there a way to make a migration from an existing database?</p><p>A. Yes, but you need to be more specific with this question because there are two ways.</p><p>The first approach will dump the schema of your existing database into a migration.</p><p>The second will dump the data as well. Why would you want to dump the data? If you&#8217;re moving machines or changing from a MySQL to a POSTGREs db, this might be useful.</p><p><strong>Approach 1: Dump schema</strong></p><p>Hint: Type in &#8220;rake -T&#8221; into your terminal. The will show you a list of all the rake tasks available to you. Everything you need is here.</p><p>Step 1: rake db:schema:dump   <em>#this will dump the schema into a file called schema.rb</em></p><p>Step 2: rake db:schema:to_migration <em>#this will turn your schema.rb file into a migration file</em></p><p><strong>Approach 2: Dump schema + data</strong></p><p>You&#8217;re going to need the YAMLdb plugin by Adam Wiggins at Heroku. To grab it from: <a
href="http://github.com/adamwiggins/yaml_db/">http://github.com/adamwiggins/yaml_db/</a></p><p>Follow the instructions on the github page.</p> ]]></content:encoded> <wfw:commentRss>http://railsnotes.com/97-turning-an-existing-database-to-a-rails-migration/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching 6/16 queries in 0.045 seconds using disk

Served from: railsnotes.com @ 2010-09-10 06:45:13 -->