开发者

FluentMigrator Failed Migrations Don't Rollback?

I just began experimenting with Fl开发者_StackOverflowuentMigrator. I noticed that failed migrations are not being rolled back. Has this just not been implemented yet? This seems rather bad because it leaves the database in a broken state.

For example, the migration below will obviously fail when it tries to add Table1 for a second time (I'm just doing this to force an error). I would expect the migration to be contained in a transaction which would then be rolled back when it fails.

[Migration(1)]
public class AddTable : Migration
{
    public override void Up()
    {
        Create.Table("Table1").WithIdColumn();
        Create.Table("Table1").WithIdColumn();
    }

    public override void Down()
    {
        Delete.Table("Table1");
    }
}

However, what happens instead is that the runner throws an error (which causes the console app to crash) and the database is left with Table1 created and no row in the VersionInfo table. This seems like a bad state to leave things in.

Using latest FluentMigrator code (as of today), Visual Studio 2008 and going against SQL Server 2008 Express.


Support for transactions was added on Jan. 26.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜