<?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: Schema Tool Update</title>
	<atom:link href="http://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/</link>
	<description>Thoughts, rants, and even some code from the mind of Barney Boisvert.</description>
	<lastBuildDate>Thu, 11 Sep 2014 09:58:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: denny</title>
		<link>https://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/comment-page-1/#comment-33856</link>
		<dc:creator>denny</dc:creator>
		<pubDate>Mon, 03 Sep 2007 05:34:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/#comment-33856</guid>
		<description>Right on, Barney!  

This is a really nice tool.  

For example, I&#039;m about to change a bunch of selects that have values like this: &#124;2008&#124; to this: 2008 -  since the database contains the old values, it will be sweet to hit them both at the same time.

I realized a bit after I posted, that you&#039;d handle &quot;overwriting&quot; in SVN (or whatever) as a conflict, before you&#039;d commit it anyways.  Unless you&#039;ve got a sql file, and a cfc... hmmm... 
As with dreamweaver- look before you put.  :]

Love the svn:keyworded, well commented files as well.  Good job, and thanks again!</description>
		<content:encoded><![CDATA[<p>Right on, Barney!  </p>
<p>This is a really nice tool.  </p>
<p>For example, I'm about to change a bunch of selects that have values like this: |2008| to this: 2008 &#8211;  since the database contains the old values, it will be sweet to hit them both at the same time.</p>
<p>I realized a bit after I posted, that you'd handle "overwriting" in SVN (or whatever) as a conflict, before you'd commit it anyways.  Unless you've got a sql file, and a cfc&#8230; hmmm&#8230;<br />
As with dreamweaver- look before you put.  :]</p>
<p>Love the svn:keyworded, well commented files as well.  Good job, and thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/comment-page-1/#comment-33834</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Mon, 03 Sep 2007 03:16:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/#comment-33834</guid>
		<description>&lt;p&gt;Denny,&lt;/p&gt;
&lt;p&gt;There IS a bug in the incrementing of the major version.  I&#039;ve fixed it in SVN, but haven&#039;t made a new public release with the fix (one more entry on my list of things to do &quot;sometime&quot;).  Since the major version only updates between migrations, the bug can only manifest itself if there is an issue with the first step of a given migration, but you&#039;re right, there is an issue there.  The minor versions (steps within a migration) are double protected: the increment happens second, and the whole thing is wrapped in a CFTRANSACTION.  The reason the major version increments first is for internal bookkeeping reasons.  It&#039;s safe for it to increment even if the first migration step fails, because it&#039;ll be minor version zero (which means the first step is still next in line).  The bug was in when the minor version was reset to zero; it happened at the wrong time before.&lt;/p&gt;
&lt;p&gt;For the two-developer conflict scenario, there&#039;s nothing the tool can do about it.  You have to resolve the conflicts when the second developer commits his/her changes.  Migration code does have some ordering ramifications, so resolving a conflict might not be as simple as otherwise (quite possibly requiring manual tweaks to the `schema_version` table), but it&#039;s really no different from any other conflict between multiple developers.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Denny,</p>
<p>There IS a bug in the incrementing of the major version.  I've fixed it in SVN, but haven't made a new public release with the fix (one more entry on my list of things to do "sometime").  Since the major version only updates between migrations, the bug can only manifest itself if there is an issue with the first step of a given migration, but you're right, there is an issue there.  The minor versions (steps within a migration) are double protected: the increment happens second, and the whole thing is wrapped in a CFTRANSACTION.  The reason the major version increments first is for internal bookkeeping reasons.  It's safe for it to increment even if the first migration step fails, because it'll be minor version zero (which means the first step is still next in line).  The bug was in when the minor version was reset to zero; it happened at the wrong time before.</p>
<p>For the two-developer conflict scenario, there's nothing the tool can do about it.  You have to resolve the conflicts when the second developer commits his/her changes.  Migration code does have some ordering ramifications, so resolving a conflict might not be as simple as otherwise (quite possibly requiring manual tweaks to the `schema_version` table), but it's really no different from any other conflict between multiple developers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: denny</title>
		<link>https://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/comment-page-1/#comment-33821</link>
		<dc:creator>denny</dc:creator>
		<pubDate>Mon, 03 Sep 2007 01:47:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/#comment-33821</guid>
		<description>Hey Barney!

  Nice tool, but I&#039;ve got a couple of questions:

It bumps the version before it executes the migration, and I&#039;m worried that if an error occurs, it&#039;ll read like the schema is up to date, when it isn&#039;t.  I put try/catch/aborts around the migrate(s), and put the revision bump at the end, to see if that would do it... it sorta did.

I&#039;m still playing with it, so I don&#039;t know if that broke something... 

The other comment is, what about a team scenario, where two members may have updated the schema at the &quot;same time&quot; so to speak?  

I figured that if this tool works for me, that problem could be solved in the &quot;business logic&quot; (always check the repository prior to adding a migration script, say), but thought it was an interesting thought, or whatever.  =]

Glad that you won a wii, that&#039;s cool-  I just checked out the projects that were submitted, and I&#039;m kinda stoked-  looks like there are a couple of them that would make great additions to what I hope to be a release of Model-Glue actionpacks to make RAD more rapid...  eh. we&#039;ll see.

Anyways, thanks for the code, esse!</description>
		<content:encoded><![CDATA[<p>Hey Barney!</p>
<p>  Nice tool, but I've got a couple of questions:</p>
<p>It bumps the version before it executes the migration, and I'm worried that if an error occurs, it'll read like the schema is up to date, when it isn't.  I put try/catch/aborts around the migrate(s), and put the revision bump at the end, to see if that would do it&#8230; it sorta did.</p>
<p>I'm still playing with it, so I don't know if that broke something&#8230; </p>
<p>The other comment is, what about a team scenario, where two members may have updated the schema at the "same time" so to speak?  </p>
<p>I figured that if this tool works for me, that problem could be solved in the "business logic" (always check the repository prior to adding a migration script, say), but thought it was an interesting thought, or whatever.  =]</p>
<p>Glad that you won a wii, that's cool-  I just checked out the projects that were submitted, and I'm kinda stoked-  looks like there are a couple of them that would make great additions to what I hope to be a release of Model-Glue actionpacks to make RAD more rapid&#8230;  eh. we'll see.</p>
<p>Anyways, thanks for the code, esse!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/comment-page-1/#comment-32321</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Mon, 27 Aug 2007 03:12:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/#comment-32321</guid>
		<description>Mark,

The &quot;cms.schema_scripts&quot; package should contain your scripts, named according to the spec of &quot;migrationXXXXXX.cfc&quot; or &quot;migrationXXXXXX.sql&quot;, depending on whether you&#039;re using CFC or SQL-based scripts.  There MUST be exactly six digits in each filename, and they MUST be numbered sequentially starting with one (or 000001).

If you&#039;ve set up your mappings correctly, the demo should definitely work, so I&#039;m not sure what&#039;s up.  The easiest way to check your mapping is to do an expandPath on it (#expandPath(&#039;/cms/schema_scripts&#039;)# for your example above), and then pass that to CFDIRECTORY and see what files it returns.  It should return the list of migration scripts.  If not, you&#039;re misconfigured somewhere.

Hope that helps.</description>
		<content:encoded><![CDATA[<p>Mark,</p>
<p>The "cms.schema_scripts" package should contain your scripts, named according to the spec of "migrationXXXXXX.cfc" or "migrationXXXXXX.sql", depending on whether you're using CFC or SQL-based scripts.  There MUST be exactly six digits in each filename, and they MUST be numbered sequentially starting with one (or 000001).</p>
<p>If you've set up your mappings correctly, the demo should definitely work, so I'm not sure what's up.  The easiest way to check your mapping is to do an expandPath on it (#expandPath('/cms/schema_scripts')# for your example above), and then pass that to CFDIRECTORY and see what files it returns.  It should return the list of migration scripts.  If not, you're misconfigured somewhere.</p>
<p>Hope that helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>https://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/comment-page-1/#comment-32217</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Sun, 26 Aug 2007 11:04:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/#comment-32217</guid>
		<description>Thanks for the reply Barney, that cleared most things up for me, and I seem to have it working so that is creates a schema_version table in whatever application I have it in, I am really impressed with how this could potentially work. However I am still unclear as to how to run the scripts in the directory that is specified, for some reason I can&#039;t get these to run, even with the demo. 

The line I am using in Application.cfm is below, this creates the schema_version fine but does not run the demo scripts which I have put in a schema_scripts directory to test.

createObject(&quot;component&quot;, &quot;schema_tool.tool&quot;).init(application.config.dsn, &quot;cms.schema_scripts&quot;).ensureCurrent(&quot;#application.applicationname#.schema_tool&quot;);

Both schema_tool and cms are mapped locations. Any help would be much appreciated.</description>
		<content:encoded><![CDATA[<p>Thanks for the reply Barney, that cleared most things up for me, and I seem to have it working so that is creates a schema_version table in whatever application I have it in, I am really impressed with how this could potentially work. However I am still unclear as to how to run the scripts in the directory that is specified, for some reason I can't get these to run, even with the demo. </p>
<p>The line I am using in Application.cfm is below, this creates the schema_version fine but does not run the demo scripts which I have put in a schema_scripts directory to test.</p>
<p>createObject("component", "schema_tool.tool").init(application.config.dsn, "cms.schema_scripts").ensureCurrent("#application.applicationname#.schema_tool");</p>
<p>Both schema_tool and cms are mapped locations. Any help would be much appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/comment-page-1/#comment-27155</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Tue, 31 Jul 2007 15:09:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/#comment-27155</guid>
		<description>Mark,

The schema_version table is a &quot;system&quot; table that the tool uses internally.  test_table and another_test_table are tables &quot;user&quot; tables that the demo app creates for itself.  In other words, every app managed by the tool will have a schema_version table, plus whatever table the app itself needs.

Application.cfm (or wherever you have app initialization code) needs the magic line that creates and runs the schema tool, and that&#039;s it.  As long as you point it at the right package (directory), it&#039;ll find all your scripts, and run them in sequence.</description>
		<content:encoded><![CDATA[<p>Mark,</p>
<p>The schema_version table is a "system" table that the tool uses internally.  test_table and another_test_table are tables "user" tables that the demo app creates for itself.  In other words, every app managed by the tool will have a schema_version table, plus whatever table the app itself needs.</p>
<p>Application.cfm (or wherever you have app initialization code) needs the magic line that creates and runs the schema tool, and that's it.  As long as you point it at the right package (directory), it'll find all your scripts, and run them in sequence.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>https://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/comment-page-1/#comment-27074</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Mon, 30 Jul 2007 22:25:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/2007/07/26/schema-tool-update-2/#comment-27074</guid>
		<description>I like the look of your schema tool, I was just wanting a few pointers in getting it working properly, I have it set up, and it has created the table &#039;schema_version&#039; and is dumping the output of this table. I was wondering if it should have also created the tables &#039;test_table&#039; and &#039;another_test_table&#039;. If I want to run the schema scripts (migration000001.cfc and migration000002.cfc) how should I do this?, is it a matter of adding a line in the application.cfm to get them running?.</description>
		<content:encoded><![CDATA[<p>I like the look of your schema tool, I was just wanting a few pointers in getting it working properly, I have it set up, and it has created the table 'schema_version' and is dumping the output of this table. I was wondering if it should have also created the tables 'test_table' and 'another_test_table'. If I want to run the schema scripts (migration000001.cfc and migration000002.cfc) how should I do this?, is it a matter of adding a line in the application.cfm to get them running?.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
