Sielnix / EFCore.Snowflake

Entity Framework Core provider for Snowflake
GNU Lesser General Public License v3.0
31 stars 2 forks source link

Nullable decimals Ignore Scale and Precision #9

Closed daniele-olivieri-rs closed 6 months ago

daniele-olivieri-rs commented 7 months ago

When generating a DbMigration model-first, nullable decimals ignore the precision and scale in the type string.

For example:

public class Entity
{
    public decimal? PurchasePrice { get; set; }
}

public class EntityConfiguration  :  IEntityTypeConfiguration<Entity>
{
    public void Configure(EntityTypeBuilder<Entity> builder)
    {
      builder.Property(x => x.PurchasePrice).HasPrecision(18, 2);
    }
}

Produces this in the DbMigration:

PURCHASE_PRICE = table.Column<decimal>(type: "NUMBER(38,18)", precision: 18, scale: 2, nullable: true),

Notice, type is "NUMBER(38,18)" instead of "NUMBER(18,2)"

Sielnix commented 6 months ago

Hello @daniele-olivieri-rs ,

Thank you for your bug report. This issue has been addressed and fixed in v8.0.4.1. Please update the package and verify if it works.

Please be advised, that if you are using migrations, then after upgrade next added migration will change column type from NUMBER(38,18) to NUMBER(18,2) in your case.

daniele-olivieri-rs commented 6 months ago

Thanks @Sielnix!