sqliteef6migrations icon indicating copy to clipboard operation
sqliteef6migrations copied to clipboard

Add support for more data types when adding a new column with default value

Open dtphan opened this issue 3 years ago • 0 comments

When I tried to add a new column with a default value, the default value was not included in the SQL statement. For example,

public override void Up()
{
    AddColumn("dbo.TestTable", "ExtraColumn", c => c.Int(nullable: false, defaultValue: 1));
}

The generated SQL would be "ALTER TABLE "TestTable" ADD COLUMN "ExtraColumn"int not null" If the table already has some data in it, there would be an error during migration: "Cannot add a NOT NULL column with default value NULL"

This pull request adds support for more data types for the default value other than DateTime.

dtphan avatar Feb 22 '22 21:02 dtphan