2016-07-07 55 views
10

我使用.Net4.5C#,我正在進行數據庫遷移using FluentMigrator之一。我能夠改變表,並通過使用如何使用FluentMigrator刪除列?

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

添加列,不過,我需要減少一些現有列,也不DeleteColumn也不DropColumn方法不上IAlterTableAddColumnOrAlterColumnOrSchemaSyntax接口。

如何使用FluentMigrator刪除列?

回答

19

發現它自己:

它去作爲單獨的聲明。

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

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