<?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>PMA Media Group&#187; migrations</title>
	<atom:link href="http://www.pmamediagroup.com/tag/migrations/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pmamediagroup.com</link>
	<description>Unique Marketing Techniques and Strategies with Guaranteed Results!</description>
	<lastBuildDate>Fri, 27 Aug 2010 18:14:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Foreign Key Migrations Plugin</title>
		<link>http://www.pmamediagroup.com/2009/04/foreign-key-migrations-plugin/</link>
		<comments>http://www.pmamediagroup.com/2009/04/foreign-key-migrations-plugin/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 16:33:51 +0000</pubDate>
		<dc:creator>Chuck Wood</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[activerecord]]></category>
		<category><![CDATA[migrations]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.pmamediagroup.com/?p=256</guid>
		<description><![CDATA[I worked on a plugin yesterday that would include all of our migration helpers. You can find it on github. Currently, it only does foreign keys work, but eventually, I&#8217;d like to have it add unique indexes on columns defined with a :unique =&#62; true attribute in the ActiveRecord migration. But for right now, here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I worked on a plugin yesterday that would include all of our migration helpers. You can find it on <a href="http://github.com/woody2shoes/migration_helpers/tree/master">github</a>. Currently, it only does foreign keys work, but eventually, I&#8217;d like to have it add unique indexes on columns defined with a :unique =&gt; true attribute in the ActiveRecord migration. But for right now, here&#8217;s how to use it:</p>
<p>Adding a foreign key that references the id column in another table:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># The column 'id' is assumed in the referenced table.</span>
add_foreign_key <span style="color:#ff3333; font-weight:bold;">:table1</span>, <span style="color:#ff3333; font-weight:bold;">:table2_ref</span>, <span style="color:#ff3333; font-weight:bold;">:table2</span></pre></div></div>

<p><span id="more-256"></span></p>
<p>Adding a foreign key that references the name column in another table:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">add_foreign_key <span style="color:#ff3333; font-weight:bold;">:table1</span>, <span style="color:#ff3333; font-weight:bold;">:table2_name</span>, <span style="color:#ff3333; font-weight:bold;">:table2</span>, <span style="color:#ff3333; font-weight:bold;">:name</span></pre></div></div>

<p>Removing a foreign key with a custom name for the SQL constraint:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">drop_foreign_key <span style="color:#ff3333; font-weight:bold;">:table1</span>, <span style="color:#996600;">&quot;table1_ref_to_table2&quot;</span></pre></div></div>

<p>Removing a foreign key with no custom name for the SQL constraint:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">drop_foreign_key <span style="color:#ff3333; font-weight:bold;">:table1</span>, <span style="color:#ff3333; font-weight:bold;">:table2_ref</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.pmamediagroup.com/2009/04/foreign-key-migrations-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.pmamediagroup.com @ 2012-02-05 03:45:43 -->
