Good afternoon, guys.
I have an application that every client owns their database and I'm using code first. To update I'm always running the command update-database -force
in the package console for each client database. Does anyone know a way to automate this process? I did a search and found this link entity-framework-code-first-migration -to-multiple-database , however, an error occurred while executing the update command.
I want to have some script to update all databases automatically, that is to say I have a context that has more than one database in web.config
.
The error that occurred is as follows:
Automatic migration was not applied because it would result in data loss. Set AutomaticMigrationDataLossAllowed to 'true' on your DbMigrationsConfiguration to allow application of automatic migrations even if they might cause data loss. Alternately, use Update-Database with the '-Force' option, or scaffold an explicit migration.