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?
Right-click the column you want to delete and choose Delete Column from the shortcut menu. If the column participates in a relationship (FOREIGN KEY or PRIMARY KEY), a message prompts you to confirm the deletion of the selected columns and their relationships. Choose Yes.
FluentMigrator is a database migration framework for . NET written in C#. The basic idea is that you can create migrations which are simply classes that derive from the Migration base class and have a Migration attribute with a unique version number attached to them.
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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With