简体   繁体   中英

Delete a column using FluentMigrator

I want to delete a column from a table using FluenMigrator ver.3.2.6.0. I saw that this question is already asked here some years ago but the solution doesn't fit for me because looks like the method for deleting columns doesn't exist anymore:

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

So my question how can I do this. Thank you.

If you are using the AutoReversingMigration interface in the class change it to 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()
        {
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM