如何使用 FluentMigrator 删除列? [英] How to drop column with FluentMigrator?

查看:52
本文介绍了如何使用 FluentMigrator 删除列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 .Net4.5C#,我正在处理数据库迁移之一 使用 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()

但是我需要删除一些现有的列,并且 DeleteColumnDropColumn 方法都不在 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆