1

有没有办法使用 Migrator.NET 回滚到特定版本?

我正在使用 MSBuild 在 SQL Server 2005 数据库上运行迁移;

"C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe" /target:UpdateDb /property:MigrationConnectionString="ConnectionString" "D:\Projects\My.Migrations.csproj"

4

1 回答 1

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:To=5(其中 5 是在 SchemaInfo 中找到的版本号)添加到问题中提到的 MSBuild 运行,我就能够回滚我的数据库。希望这可以帮助某人。

于 2010-11-25T15:43:59.117 回答