【问题标题】:Delete a column using FluentMigrator使用 FluentMigrator 删除列
【发布时间】:2020-08-17 10:39:48
【问题描述】:

我想使用 FluenMigrator ver.3.2.6.0 从表中删除一列。我看到这个问题已经在几年前被问过here 但该解决方案不适合我,因为删除列的方法似乎不再存在:

Delete.Column("ColumnName").FromTable("TableName").InSchema("SchemaName");

所以我的问题是我该怎么做。 谢谢。

【问题讨论】:

    标签: asp.net-core fluent-migrator


    【解决方案1】:

    如果您在类中使用AutoReversingMigration 接口,请将其更改为Migration

    using FluentMigrator;
    
    namespace proyect_name.Migrations.DefaultDB
    {
        [Migration(20210412174600)]
        public class CamsDB_20210412_174600_MigrationName : Migration
        {
            public override void Up()
            {
                Delete.Column("ColumnName").FromTable("TableName").InSchema("dbo");
            }
    
            public override void Down()
            {
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2016-11-09
      • 2014-08-07
      • 2019-01-26
      • 2017-07-21
      • 2013-01-18
      • 2017-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多