Open jeffbromberger opened 7 years ago
That's odd. I was able to reproduce this, and confirmed that the alter statement is being generated by our EF provider, but not getting sent to the server. I added this silly select 1
to my migration, like so:
migrationBuilder.AlterColumn<string>(
name: "TestField",
table: "Client",
type: "varchar(1024)",
nullable: false);
migrationBuilder.Sql("select 1");
And that caused the alter column command to be sent to the DB. @how02 do you think this is our bug, or something upstream? I didn't see any sort of explicit "commit" type operation for any of the other ops.
+1 for this. I noticed the problem with a property like this:
[Column(TypeName = "text")] public string ResponseBody { get; set; }
The property doesn't get respected by the entity framework (not your bug I guess), but when I set the type manually in the fluent api (inside OnModelCreating):
builder.Entity<TransactionLog>().Property(l => l.ResponseBody).HasColumnType("text");
and did a Add-Migration it created the following:
migrationBuilder.AlterColumn<string>( name: "ResponseBody", table: "TransactionLog", type: "text", nullable: true, oldClrType: typeof(string), oldNullable: true);
but did not have an effect when applying Update-Database. If I delete all migrations and create a new one the tables are created properly (still not by respecting the property, but due to the fluent api commands).
I am experiencing exactly the same. The migration itself looks fine with the AlterColumn
statement, but no queries are sent to the server.
+1
+1
This library hasn't been maintained for years. I would suggest using one of the providers on this page: https://docs.microsoft.com/en-us/ef/core/providers/?tabs=dotnet-core-cli
I had a property which was a "string" and this of course created a varchar(255) in MySQL. After realizing that I needed more space, I added the following fluent:
Then I ran add-migration and saw that it generated this:
However, when I run update-database, nothing changes in MySQL. I repeated all the steps and logged all the queries and there is only this one:
No alter query seems to be generated...