How to drop column with FluentMigrator?

Matas Vaitkevicius picture Matas Vaitkevicius · Jul 7, 2016 · Viewed 10.3k times · Source

I am using .Net4.5 and C#, I am working on one of database migrations using FluentMigrator. I am able to alter tables and add columns by using

Alter.Table("Items").InSchema("Pricing")
            .AddColumn("CanBe").AsBoolean().NotNullable()

However I need to drop some existing columns and nor DeleteColumn nor DropColumn methods are not on IAlterTableAddColumnOrAlterColumnOrSchemaSyntax interface.

How do I drop columns using FluentMigrator?

Answer

Matas Vaitkevicius picture Matas Vaitkevicius · Jul 7, 2016

Found it myself:

It has to go as separate statement.

Alter.Table("Items").InSchema("Pricing")
        .AddColumn("CanBe").AsBoolean().NotNullable();

Delete.Column("AllowSubscription").FromTable("Items").InSchema("Pricing");