<?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>Blog - ShiftEleven &#187; migration</title>
	<atom:link href="http://shifteleven.com/articles/tag/migration/feed" rel="self" type="application/rss+xml" />
	<link>http://shifteleven.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 19 Sep 2009 11:19:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
		<item>
		<title>Loading Fixtures in a Migration</title>
		<link>http://shifteleven.com/articles/2006/09/28/loading-fixtures-in-a-migration</link>
		<comments>http://shifteleven.com/articles/2006/09/28/loading-fixtures-in-a-migration#comments</comments>
		<pubDate>Thu, 28 Sep 2006 20:57:23 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[fixtures]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://dev.fecalrod.com/articles/2006/09/28/loading-fixtures-in-a-migration</guid>
		<description><![CDATA[I love migrations I think they are one of the best things about rails.  I love that I can count on any changes I&#8217;ve done in the database to be consistent across all other databases that I use.  Love it.
Sometimes I find that I want pre-load my database with some data, like categories [...]]]></description>
			<content:encoded><![CDATA[<p>I love <a href="http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations.">migrations</a> I think they are one of the best things about rails.  I love that I can count on any changes I&#8217;ve done in the database to be consistent across all other databases that I use.  Love it.</p>
<p>Sometimes I find that I want pre-load my database with some data, like categories that I have.  For testing purposes, I have already created this data in my fixture; now I just want to load that fixture into my database from a migration call.</p>
<p>I know that there is a <code>rake</code> task for this, so I looked into that code and came up with a little something.</p>
<p><span id="more-14"></span></p>
<pre class="ruby" title="code">require 'active_record/fixtures'

class CreateCategories &lt; ActiveRecord::Migration
  def self.up
    create_table :categories do |t|
      t.column :name, :string
    end

    Fixtures.create_fixtures('test/fixtures', File.basename("categories.yml", '.*'))
  end

  def self.down
    drop_table :categories
  end
end</pre>
<p>First I had to require <code>active_record/fixtures</code>.  This allows me to call the <code>Fixtures#create_fixtures</code> method, which load my data.  Now I can gaurantee that my fixture data will be loaded for any environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2006/09/28/loading-fixtures-in-a-migration/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Sleeping Easier with Migrations</title>
		<link>http://shifteleven.com/articles/2006/09/28/sleeping-easier-with-migrations</link>
		<comments>http://shifteleven.com/articles/2006/09/28/sleeping-easier-with-migrations#comments</comments>
		<pubDate>Thu, 28 Sep 2006 20:48:33 +0000</pubDate>
		<dc:creator>K. Adam Christensen</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://dev.fecalrod.com/articles/2006/09/28/sleeping-easier-with-migrations</guid>
		<description><![CDATA[As a rails user who loves migrations, I have noticed that all of the migrations are prefixed with three decimal places, like 001_create_sessions.rb or something of that nature.  That got me thinking, what would happen after I had 999 migrations?
That sets of the paranoia level up because who knows, I may need 1001 migrations! [...]]]></description>
			<content:encoded><![CDATA[<p>As a <a href="http://www.rubyonrails.org">rails</a> user who loves migrations, I have noticed that all of the migrations are prefixed with three decimal places, like <code>001_create_sessions.rb</code> or something of that nature.  That got me thinking, what would happen after I had 999 migrations?</p>
<p>That sets of the paranoia level up because who knows, I may need 1001 migrations!  So to settle this once and for all, I wrote a script that would generate 999 migrations for me.  I ran the 1000 migration and then it created <code>1001_test1001.rb</code>.</p>
<p>Good news! Rails doesn&#8217;t constrain its migrations to a 3 decimal place prefix.  So pointless&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://shifteleven.com/articles/2006/09/28/sleeping-easier-with-migrations/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
