我们正在使用FluentMigrator
在一个项目中使用。假设我在下面得到了这样的代码。
所以每次我们运行新的迁移时,所有以前的数据都会被删除。有没有办法避免它并将数据保存在不变的地方?
public class Migration1 : Migration
{
public override void Up() {
Create.Table("Project")
.WithColumn("id").AsInt64().PrimaryKey().Identity()
.WithColumn("name").AsString(30).Nullable()
.WithColumn("author").AsString(30).Nullable()
.WithColumn("date").AsDate().Nullable()
.WithColumn("description").AsString(1000).Nullable();
Create.Table("Data")
.WithColumn("id").AsInt64().PrimaryKey().Identity()
.WithColumn("project_id").AsInt64().ForeignKey("Project", "id")
.WithColumn("a").AsInt32().Nullable()
.WithColumn("b").AsInt32().Nullable()
.WithColumn("c").AsInt32().Nullable()
.WithColumn("d").AsInt32().Nullable();
}
public override void Down() {
Delete.Table("data");
Delete.Table("project");
}
}