-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
EF core creates migration adding indentation white chars into value #15256
Comments
Tricky, tricky. This line would need more information about what can and can't be indented. The easiest fix would be to not indent the body of the IF statement... but that's ugly for everyone else. |
The workaround is to use... .HasDefaultValueSql(
"N'Don''t' + CHAR(13) + CHAR(10) + N'GO' + CHAR(13) + CHAR(10) + N'this way'"); I suppose we could always generate string literals with newlines like this. |
Fixes aspnet#15256
Closed fixed by #20304 |
Note: I filed #20391 to track a similar issue for |
This is unfortunately a bit more complicated for PostgreSQL - there are contexts where only a true literal is valid. For example, this breaks test MigrationsNpgsqlTest.Create_table_with_multiline_comments, since the PG comment syntax doesn't accept expressions with concatenation operators. It may be better to selectively apply the concatenation logic in NpgsqlMigrationsSqlGenerator where we know it's valid (e.g. default value), rather than broadly in the StringTypeMapping's literal generation logic. |
EF core creates migration adding indentation white chars into value when generating .sql script.
Steps to reproduce
create migration:
run: add-migration test
when creating .sql migration: dotnet ef migrations script -i
indentation is applied inside quoted value
Further technical details
EF Core version: 2.2.3
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
The text was updated successfully, but these errors were encountered: