如何使用 FluentMigrator 删除列? [英] How to drop column with FluentMigrator?
本文介绍了如何使用 FluentMigrator 删除列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 .Net4.5
和 C#
,我正在处理数据库迁移之一 使用 FluentMigrator
.我可以使用
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()
但是我需要删除一些现有的列,并且 DeleteColumn
和 DropColumn
方法都不在 IAlterTableAddColumnOrAlterColumnOrSchemaSyntax
接口上.
However I need to drop some existing columns and nor DeleteColumn
nor DropColumn
methods are not on IAlterTableAddColumnOrAlterColumnOrSchemaSyntax
interface.
如何使用 FluentMigrator 删除列?
推荐答案
自己发现:
它必须作为单独的声明.
It has to go as separate statement.
Alter.Table("Items").InSchema("Pricing")
.AddColumn("CanBe").AsBoolean().NotNullable();
Delete.Column("AllowSubscription").FromTable("Items").InSchema("Pricing");
这篇关于如何使用 FluentMigrator 删除列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文