<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Standalone Migrations: Using Rails migrations in non Rails projects</title>
	<atom:link href="http://gabrito.com/post/standalone-migrations-using-rails-migrations-in-non-rails-projects/feed" rel="self" type="application/rss+xml" />
	<link>http://gabrito.com/post/standalone-migrations-using-rails-migrations-in-non-rails-projects</link>
	<description>Anecdotes on Java, Ruby, Sysadmin, SEO, Design, and Management</description>
	<lastBuildDate>Fri, 05 Mar 2010 18:01:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Todd Huss</title>
		<link>http://gabrito.com/post/standalone-migrations-using-rails-migrations-in-non-rails-projects/comment-page-1#comment-203064</link>
		<dc:creator>Todd Huss</dc:creator>
		<pubDate>Wed, 08 Jul 2009 22:45:13 +0000</pubDate>
		<guid isPermaLink="false">http://gabrito.com/?p=194#comment-203064</guid>
		<description>Great suggestions Bryon, I&#039;ve implemented all of your changes (and re-added the database_sample.yml file).</description>
		<content:encoded><![CDATA[<p>Great suggestions Bryon, I&#8217;ve implemented all of your changes (and re-added the database_sample.yml file).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BryonB</title>
		<link>http://gabrito.com/post/standalone-migrations-using-rails-migrations-in-non-rails-projects/comment-page-1#comment-202960</link>
		<dc:creator>BryonB</dc:creator>
		<pubDate>Wed, 08 Jul 2009 01:17:06 +0000</pubDate>
		<guid isPermaLink="false">http://gabrito.com/?p=194#comment-202960</guid>
		<description>I wanted to be able to specify different environments in the database.yml file like I can in Rails, so I modifed the :ar_init task in the Rakefile as follows:

  task :ar_init do
    require &#039;active_record&#039;
    require &#039;yaml&#039;
    ENV[&#039;RAILS_ENV&#039;] &#124;&#124;= &#039;development&#039;
    config = YAML.load_file(APP_BASE + &quot;/config/database.yml&quot;)[ENV[&#039;RAILS_ENV&#039;]]
    ActiveRecord::Base.establish_connection(config)
    logger = Logger.new $stderr
    logger.level = Logger::INFO
    ActiveRecord::Base.logger = logger
  end

Now, I can pass RAILS_ENV as a parameter to db:migrate, like I can with Rails migrations, and it will use the &#039;development&#039; environment by default.

Also, adding the following line at the end of the migrate task, to invoke the db:schema:dump task causes a schema.rb file to be dumped at the end of each migration, like it does in Rails.  This is handy if you want to be able to use db:schema:load to set up a new environment from the schema.rb file.

Rake::Task[ &quot;db:schema:dump&quot; ].execute

Cheers!</description>
		<content:encoded><![CDATA[<p>I wanted to be able to specify different environments in the database.yml file like I can in Rails, so I modifed the :ar_init task in the Rakefile as follows:</p>
<p>  task :ar_init do<br />
    require &#8216;active_record&#8217;<br />
    require &#8216;yaml&#8217;<br />
    ENV['RAILS_ENV'] ||= &#8216;development&#8217;<br />
    config = YAML.load_file(APP_BASE + &#8220;/config/database.yml&#8221;)[ENV['RAILS_ENV']]<br />
    ActiveRecord::Base.establish_connection(config)<br />
    logger = Logger.new $stderr<br />
    logger.level = Logger::INFO<br />
    ActiveRecord::Base.logger = logger<br />
  end</p>
<p>Now, I can pass RAILS_ENV as a parameter to db:migrate, like I can with Rails migrations, and it will use the &#8216;development&#8217; environment by default.</p>
<p>Also, adding the following line at the end of the migrate task, to invoke the db:schema:dump task causes a schema.rb file to be dumped at the end of each migration, like it does in Rails.  This is handy if you want to be able to use db:schema:load to set up a new environment from the schema.rb file.</p>
<p>Rake::Task[ "db:schema:dump" ].execute</p>
<p>Cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BryonB</title>
		<link>http://gabrito.com/post/standalone-migrations-using-rails-migrations-in-non-rails-projects/comment-page-1#comment-202948</link>
		<dc:creator>BryonB</dc:creator>
		<pubDate>Tue, 07 Jul 2009 21:37:28 +0000</pubDate>
		<guid isPermaLink="false">http://gabrito.com/?p=194#comment-202948</guid>
		<description>Todd, there doesn&#039;t seem to be any config/database_sample.yml file in the GitHub project when I download it.  Are there any differences between the database.yml file here and one in a standard rails project?  Can you still define different environments (development, production, etc.)?  If so, where do you define them?</description>
		<content:encoded><![CDATA[<p>Todd, there doesn&#8217;t seem to be any config/database_sample.yml file in the GitHub project when I download it.  Are there any differences between the database.yml file here and one in a standard rails project?  Can you still define different environments (development, production, etc.)?  If so, where do you define them?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
