2010-11-25 83 views
1

是否有任何方式使用Migrator.NET回滾到特定版本?如何使用Migrator.NET遷移到特定版本

我正在使用MSBuild在SQL Server 2005數據庫上運行遷移;

「C:\ Windows \ Microsoft.NET \框架\ v3.5版本\ MSBuild.exe」 /靶:updatedb的 /屬性:MigrationConnectionString = 「的ConnectionString」 「d:\項目\ My.Migrations .csproj「

回答

2

我發現我的目標部分(在My.Migrations.csproj中)有一個名爲」To「的屬性。

<Target Name="UpdateDb"> 
    <CreateProperty Condition="'$(To)'==''" value="-1"> 
     <Output PropertyName="To" TaskParameter="Value"> 
     </Output> 
    </CreateProperty> 
    <Migrate Provider="SqlServer" Connectionstring="$(MigrationConnectionString)" Migrations="$(OutputPath)$(AssemblyName).dll" To="$(To)" /> 
    </Target> 

所以才加入/P:爲了= 5(其中5是在SchemaInfo發現版本號)在這個問題提到運行的MSBuild的,我可以回滾我的數據庫。希望這可以幫助某人。