1
When generating an update of db
which results in possible data loss efcore
shows the alert:
An Operation was scaffolded that may result in the Oss of data. Please review the Migration for Accuracy.
(In this specific case a field has been removed from the table)
When this occurs the structure of db
is not amended.
To get around this situation I remove all migrations
generated and Gero a new, with this, the new structure is successfully generated.
(As the app is not in production, so far I did not bother to recreate the db
)
I would like to know the correct way to solve this kind of problem, ie, force table update even knowing of data loss. Or if there’s a better way to solve this kind of situation.
So there’s no way
Forçar atualização da tabela
to delete a field or an index for example being required to recreate the entire database? If I delete all themigrations
tables in production will surely get unnecessary fields/indexes correct @gypsy-Morrison-Mendez?– rubStackOverflow
Correct. As I have recommended in recent months, everything that involves the Stack .NET Core is still unstable, in development, so the recommended is to wait and not make large and critical systems for production until the Stack is stable. Possibly new features will come to replace old features (such as data Loss and automatic migrations).
– Leonel Sanches da Silva
Addendum: in the future I will have to update this answer because the mechanisms that should remedy your doubt do not yet exist.
– Leonel Sanches da Silva