migrate NAnt task

Just added an NAnt task to the migrator project. So if you would like to use it without the Castle Generator you could use this simple NAnt task on your own super projects:

<loadtasks assembly=".../Migrator.NAnt.dll" />
<target name="migrate" description="Migrate the database" depends="build">
  <property name="version" value="-1" overwrite="false" />
  <migrate
    provider="MySql|PostgreSQL|SqlServer"
    connectionstring="Database=MyDB;Data Source=localhost;User Id=;Password=;"
    migrations="bin/MyProject.dll"
    to="${version}" />
</target>

Note that this version of the Migrator as not yet been updated in the Castle Generator libs because some work is still in progress for next release (something like SQLite support and other cool stuff) so you have to get the source and build it yourself from http://code.macournoyer.com/svn/migrator/trunk/.

Thanks to all people supporting the project!

5 Comments

Filed under Migrator

5 responses to “migrate NAnt task

  1. Looks like a great start! While getting the build up and running today, I noticed two things:

    1) The readme says run “nant build.release” but I think it should be “nant build”
    2) The test RemoveBoolColumn fails for the SqlServerTransformationProvider. In investigating this, we discovered that removing the following bit of SQL from the DeleteColumnConstraints method fixes that test and does not break any others:

    ” AND cont.info = col.colid”

    Let us know if you would prefer this in a patch.

    Cheers,
    Luke Melia & Daniel Berlinger

  2. Forgot to mention I was testing against SQL Server 2005.

  3. I fixed the info in the doc/readme file. For #2 I’ll test it on 2000 before applying this.

    Thanks for your help Luke!

  4. We found a problem where two calls to MigrateTo are run back to back. When you call Commit you check if the transaction != null. After the first series the connection is closed but the transaction is not set to null. Setting it to null clears the problem. The same applies to Rollback. (Both in TransformationProvider.cs)

    Also, accessing migrator.CurrentVersion after a MigrateTo call will throw an exception, because the MigrateTo commit/rollback will close the connection. Seems like the CurrentVersion property assumes the connection is open.

    All this using the SqlServerTransformationProvider against at Sql Server 2005 db.

    Regards,
    Daniel Berlinger and Lee Bankewitz

  5. Should be all fixed in revision 103, but I haven’t tested on SQL Server 2005, only on 2000 and MySql. Let me know if it still not working

    thanks for pointing this out!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s