Skip to content

Scaffold operation doesn't add default value for not nullable property #3683

@sciutand

Description

@sciutand

Since migrating to dotnet10 and <PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0"/>
running

dotnet ef dbcontext scaffold  "Name=DB:ConnectionString" Npgsql.EntityFrameworkCore.PostgreSQL

Causes the generate DBCtx to not have default value for columns that are not nullable and have a default value:

eg:

Found column with table: prod_ui.projects, column name: framework_id, data type: integer, nullable: False, identity: False, default value: 0, computed value: (null)

used to yield:

 entity.Property(e => e.FrameworkId)
                .HasDefaultValue(0)
                .HasColumnName("framework_id");

since the update it yields:

entity.Property(e => e.FrameworkId).HasColumnName("framework_id");

This is obviously a big issue for us as we are no longer able to update our context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions