-
Notifications
You must be signed in to change notification settings - Fork 381
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
Useless AlterColumn operations are generated for TimeStampAttribute-marked properties on every migration #792
Comments
I have the same issue - I can generate the migration and apply it, but all other migrations I generate have this.. |
A simple workaround is to use [Required, TimeStamp, ConcurrencyCheck]
public DateTime RowVersion { get; set; } // <-- changed from byte[] to DateTime The support for @caleblloyd Do you remember what the reason for removing |
Yes, it worked, thanks :)
|
Still depends on dotnet/efcore#18592 Addresses PomeloFoundation#792
This might be an EF Core bug. |
Okay, that might be so. ValueConverters handling is still far from perfect ( |
* Add support to reverse engineer views. Add comments for tables and columns. Improve handling of default values. * Handle the `CURRENT_TIMESTAMP` default value for `timestamp` columns correctly. Fixes #703 * Correctly implement `CURRENT_TIMESTAMP` with `ON UPDATE` clauses. Introduce a workaround for the missing EF Core handling of `ValueGenerated.OnUpdate`. Fixes #877 * Remove unnecessary code Can probably remove this code as it only applies to Release Candidate not General Availability versions. https://bugs.mysql.com/bug.php?id=89793 >The NON_UNIQUE column in the INFORMATION_SCHEMA.STATISTICS table had type BIGINT prior to MySQL 8.0, but became VARCHAR in MySQL 8.0 with the introduction of the data dictionary. The NON_UNIQUE column now has an integer type again (INT because the column need not be as large as BIGINT). * Correctly map `unsigned` database types with precision, scale, size or display width to CLR types. * Fix table/view determination. * Support views in `MySqlDatabaseCleaner`. * Fix some Timestamp/RowVersion issues. Still depends on dotnet/efcore#18592 Addresses #792
This specific problem is fixed by #896 and dotnet/efcore#18599. |
I am running v3.1.0-rc1.final and am still having this issue. I even changed all my byte[] columns to DateTime and still have the issue. Am I missing something here? |
The intonation here is on specific. The issue @msvprogs posted was about a While fixing the issue, others came up and we opened an issue on the EF Core repo upstream, that also contained a sub issue about the same property setup described here, but without the [Timestamp] // <-- without [Required] attribute
public byte[] RowVersion { get; set; } This one has not been fixed yet, because it is blocked by another EF Core issue:
You can read up on this one here: dotnet/efcore#18592 If you think your issue is not related to the one described above, than please post your model class, its definition and the generated migrations. If your issue is related and you need a workaround, the following line should work: [Timestamp, Required] // <-- use [Required] attribute
public byte[] RowVersion { get; set; } |
Perfect many thanks for the detailed explanation. Your workaround worked perfectly. |
@msvprogs Thanks for creating this issue. I had this issue for almost 2 years and now it's solved. Many thanks guys. :) |
Steps to reproduce
Consider the following model:
The issue
When I make a migration, useless AlterColumn operations are issued, even if there are no changes in the model.
Further technical details
MySQL version: 8.0
Operating system: Windows 10 Pro
Pomelo.EntityFrameworkCore.MySql version: 2.2.0
The text was updated successfully, but these errors were encountered: