<?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: Database Migrations for .NET</title>
	<atom:link href="http://www.zorched.net/2008/04/20/database-migrations-for-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zorched.net/2008/04/20/database-migrations-for-net/</link>
	<description>Musings of a software developer in Milwaukee, WI.</description>
	<pubDate>Tue, 06 Jan 2009 11:28:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Spencer</title>
		<link>http://www.zorched.net/2008/04/20/database-migrations-for-net/comment-page-1/#comment-14017</link>
		<dc:creator>Spencer</dc:creator>
		<pubDate>Thu, 28 Aug 2008 21:00:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.zorched.net/?p=102#comment-14017</guid>
		<description>Thanks.  I ended up creating an extension that is called in the AfterUp method.  It is SQL-specific, because that is what will be used for this system; I need to look into making it useful for the other supported systems and then proposing a patch.  In case anyone else wants to see it, here is the class that handles my stamp-like columns:
&lt;code lang="csharp"&gt;
public static class MigrationHelper
{
    /// 
    /// This SQL Server-Specific method creates a Timestamp column.
    /// 
    /// 
    /// 
     public static void AddConcurrencyChecking(ITransformationProvider database, string tableName)
    {
          string addTimestampQuery = "ALTER TABLE " + tableName + " ADD timestamp TIMESTAMP NOT NULL;";
          IDbCommand cmd = database.GetCommand();
          cmd.Connection.Open();
          database.ExecuteNonQuery(addTimestampQuery);
          cmd.Connection.Close();         
    }
     public static void AddTimeStamps(ITransformationProvider database, string tableName)
    {
            AddColumn(database, tableName, "created_at", DbType.DateTime);
            AddColumn(database, tableName, "updated_at", DbType.DateTime);
    }
     public static void AddUserStamps(ITransformationProvider database, string tableName)
    {
          AddColumn(database, tableName, "created_by", DbType.Int32);
          AddColumn(database, tableName, "updated_by", DbType.Int32);
    }
     private static void AddColumn(ITransformationProvider database, string tableName, string columnName, DbType dbType)
    {
          database.AddColumn(tableName, new Migrator.Framework.Column(columnName,dbType));
    }
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Thanks.  I ended up creating an extension that is called in the AfterUp method.  It is SQL-specific, because that is what will be used for this system; I need to look into making it useful for the other supported systems and then proposing a patch.  In case anyone else wants to see it, here is the class that handles my stamp-like columns:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">class</span> MigrationHelper
<span style="color: #000000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">/// </span>
    <span style="color: #008080; font-style: italic;">/// This SQL Server-Specific method creates a Timestamp column.</span>
    <span style="color: #008080; font-style: italic;">/// </span>
    <span style="color: #008080; font-style: italic;">/// </span>
    <span style="color: #008080; font-style: italic;">/// </span>
     <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> AddConcurrencyChecking<span style="color: #000000;">&#40;</span>ITransformationProvider database, <span style="color: #FF0000;">string</span> tableName<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
          <span style="color: #FF0000;">string</span> addTimestampQuery <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;ALTER TABLE &quot;</span> <span style="color: #008000;">+</span> tableName <span style="color: #008000;">+</span> <span style="color: #666666;">&quot; ADD timestamp TIMESTAMP NOT NULL;&quot;</span>;
          IDbCommand cmd <span style="color: #008000;">=</span> database.<span style="color: #0000FF;">GetCommand</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
          cmd.<span style="color: #0000FF;">Connection</span>.<span style="color: #0000FF;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
          database.<span style="color: #0000FF;">ExecuteNonQuery</span><span style="color: #000000;">&#40;</span>addTimestampQuery<span style="color: #000000;">&#41;</span>;
          cmd.<span style="color: #0000FF;">Connection</span>.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;         
    <span style="color: #000000;">&#125;</span>
     <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> AddTimeStamps<span style="color: #000000;">&#40;</span>ITransformationProvider database, <span style="color: #FF0000;">string</span> tableName<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
            AddColumn<span style="color: #000000;">&#40;</span>database, tableName, <span style="color: #666666;">&quot;created_at&quot;</span>, DbType.<span style="color: #0000FF;">DateTime</span><span style="color: #000000;">&#41;</span>;
            AddColumn<span style="color: #000000;">&#40;</span>database, tableName, <span style="color: #666666;">&quot;updated_at&quot;</span>, DbType.<span style="color: #0000FF;">DateTime</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
     <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> AddUserStamps<span style="color: #000000;">&#40;</span>ITransformationProvider database, <span style="color: #FF0000;">string</span> tableName<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
          AddColumn<span style="color: #000000;">&#40;</span>database, tableName, <span style="color: #666666;">&quot;created_by&quot;</span>, DbType.<span style="color: #0000FF;">Int32</span><span style="color: #000000;">&#41;</span>;
          AddColumn<span style="color: #000000;">&#40;</span>database, tableName, <span style="color: #666666;">&quot;updated_by&quot;</span>, DbType.<span style="color: #0000FF;">Int32</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
     <span style="color: #0600FF;">private</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> AddColumn<span style="color: #000000;">&#40;</span>ITransformationProvider database, <span style="color: #FF0000;">string</span> tableName, <span style="color: #FF0000;">string</span> columnName, DbType dbType<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
          database.<span style="color: #0000FF;">AddColumn</span><span style="color: #000000;">&#40;</span>tableName, <span style="color: #008000;">new</span> Migrator.<span style="color: #0000FF;">Framework</span>.<span style="color: #0000FF;">Column</span><span style="color: #000000;">&#40;</span>columnName,dbType<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Geoff Lane</title>
		<link>http://www.zorched.net/2008/04/20/database-migrations-for-net/comment-page-1/#comment-13884</link>
		<dc:creator>Geoff Lane</dc:creator>
		<pubDate>Fri, 22 Aug 2008 14:53:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.zorched.net/?p=102#comment-13884</guid>
		<description>Spencer,
It does not currently support automated timestamps or anything. You can of course create your own timestamp tables using the framework, but the framework won't do anything special with them.</description>
		<content:encoded><![CDATA[<p>Spencer,<br />
It does not currently support automated timestamps or anything. You can of course create your own timestamp tables using the framework, but the framework won&#8217;t do anything special with them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Spencer</title>
		<link>http://www.zorched.net/2008/04/20/database-migrations-for-net/comment-page-1/#comment-13878</link>
		<dc:creator>Spencer</dc:creator>
		<pubDate>Fri, 22 Aug 2008 09:13:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.zorched.net/?p=102#comment-13878</guid>
		<description>Question - does Migrator support timestamps in the table creation?  I wanted to use that to do dirty checks, but I'm not seeing an option anywhere.
Thanks in advance...</description>
		<content:encoded><![CDATA[<p>Question - does Migrator support timestamps in the table creation?  I wanted to use that to do dirty checks, but I&#8217;m not seeing an option anywhere.<br />
Thanks in advance&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
