Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of Column type will create a messed up migration #24365

Closed
ByteCraftServices opened this issue Mar 10, 2021 · 1 comment · Fixed by #24517
Closed

Usage of Column type will create a messed up migration #24365

ByteCraftServices opened this issue Mar 10, 2021 · 1 comment · Fixed by #24517
Labels
area-type-mapping closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Milestone

Comments

@ByteCraftServices
Copy link

In my migration always the default scale and precision (18,2) is applied to a use defined type. In my case the UDT has does not match 18,2. So the migration cannot be applied to the database, until I remove it manually from the migration.cs file

DBContext.cs:

foreach (var property in _modelBuilder.Model.GetEntityTypes()
                                            .SelectMany(t => t.GetProperties())
                                            .Where(p => p.ClrType == typeof(decimal)))
{
    property.SetColumnType("DefNumeric");
}

Migration.cs:

PerIC = table.Column<decimal>(type: "DefNumeric(18,2)", nullable: false)  //Wrong
PerIC = table.Column<decimal>(type: "DefNumeric", nullable: false)        //Correct

Is there a way to stopp appliying the default scale & precision autmatically to an UDT?

@ajcvickers
Copy link
Member

Related: #20773 #12796

@ajcvickers ajcvickers self-assigned this Mar 16, 2021
@ajcvickers ajcvickers added this to the 6.0.0 milestone Mar 16, 2021
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Mar 25, 2021
@ajcvickers ajcvickers modified the milestones: 6.0.0, 6.0.0-preview4 Mar 25, 2021
ajcvickers added a commit that referenced this issue Mar 31, 2021
Stop appending facets to SQL Server type aliases

Fixes #24365

Co-authored-by: Brice Lambson <brice@bricelam.net>
@ajcvickers ajcvickers modified the milestones: 6.0.0-preview4, 6.0.0 Nov 8, 2021
@ajcvickers ajcvickers removed their assignment Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-type-mapping closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants