I was using code-first migrations in a .NET Core project with a SQL Server database. But due to unblocking himself, my coworker had to manually change the database tables. Is there an elegant way to sync up migrations with the database, and continue using code-first after manual interference?
Just a bit more insights, this is the error:
Column names in each table must be unique. Column name 'xxx' in table 'xxx' is specified more than once.
Of course - this is due to the column that already exists in the database.
Thanks!
It is possible when your changes are matching his.
Just use Script-Migration
command and from the generated script remove the commands(alter, create, etc) which are already in place in the target database.
At the end keep the INSERT INTO [__EFMigrationsHistory] ...
command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With