-
Notifications
You must be signed in to change notification settings - Fork 9
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
String fields without max length constraint default to varchar(255) #47
Comments
Seems reasonable to me on the surface, but I'm worried about the semantic differences between I'm curious as to what the official MySql provider does. |
Ok well I'll try fix my issues by making sure max length constraints are specified on all fields. Relying on provider defaults probably isn't a good idea anyway. Last time I checked migrations didn't work with the official MySQL provider so I gave up on it. Your provider is currently the best for MySQL 👍 |
I am trying to find a work around for this issue by changing the migration but no matter what I do I can't figure out how to get the Insert statement to not say "(size = 255)." You can get the migration files here: I've changed the migration files in the following way: (I've also tried several other permutations including removing the HasMaxLength method) PersistedGrantDbContextModelSnapshot.cs--> 20170227232536_InitialIdentityServerPersistedGrantDbMigration.cs-> The database generates Text as the data type but the insert statement still will clip the column because it says (size = 255) Executed DbCommand (3ms) [Parameters=[@p0='?' (Size = 200), @p1='?' (Size = 50), @p2='?' (Size = 200), @p3='?', @P4='?' (Size = 255), @p5='?', @p6='?' (Size = 200)], CommandType='Text', CommandTimeout='30'] Seems like all strings has (size=) in the insert. How do you remove or change it so that it respects the maxlength instead of limiting number to 255. |
@Blastnsmash You've changed the migrations, but the entity mapping will still be the same and will have a default max length of 255 applied. To fix your issue I think you'll need to modify the mapping somehow and I'm not sure we can currently do that. Here's how identity server is do the entity mappings: https://github.com/IdentityServer/IdentityServer4.EntityFramework/blob/dev/src/IdentityServer4.EntityFramework/Extensions/ModelBuilderExtensions.cs Hopefully we have a solution to this at some stage: https://github.com/IdentityServer/IdentityServer4.EntityFramework/issues/54 |
I am running into the same issue as @Blastnsmash. |
This library is no longer maintained, I would suggest switching to the Pomelo provider. |
I would suggest now using the actual mysql driver as that is now supported
…________________________________
From: Noah Potash <[email protected]>
Sent: Saturday, September 16, 2017 5:56:41 AM
To: SapientGuardian/SapientGuardian.EntityFrameworkCore.MySql
Cc: Subscribed
Subject: Re: [SapientGuardian/SapientGuardian.EntityFrameworkCore.MySql] String fields without max length constraint default to varchar(255) (#47)
This library is no longer maintained, I would suggest switching to the Pomelo provider.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#47 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AIJiazrQ5z3gWKynfAjQ_kopsYRUpyfeks5sitZ5gaJpZM4MBJpt>.
|
Hi I'm working with a 3rd party framework which maps some fields without a
HasMaxLength
constraint. The provider looks like it defaults to varchar(255) columns for these fields. This seems fine, but it makes the provider inconsistent with the SQL Server provider which instead defaults to usingnvarchar(max)
(which is similar toTEXT
). This is causing data to be truncated and errors to occur in some situations.The obvious solution would be to modify the entity mappings and add the max length constraints. Unfortunately I cannot do this with the 3rd party framework I'm using, but I've asked the developers if they'd be willing to do this.
Just wondering if it would also make sense to change the default in this provider to create columns as
TEXT
when no max length is specified. This would increase compatibility between this provider and the SQL Server provider. What are your thoughts?The text was updated successfully, but these errors were encountered: