A few weeks ago I enabled migration on my project and added a column 'ClientID' to the AspNetUsers table.
PM> Add-Migration "Name"
Remove the Migrations folder in your project
Delete the _MigrationHistory
table from your database.
Enable-Migrations
command from your Package Manager Console. Add-Migration Init
command to create a migration. Up()
function for the initial migration. (To create an empty migration and solve the errors that you are facing.) Update-Database
command to apply your empty migration. Add-Migration InitNew
command to create a new migration. Update-Database
command to apply the changes. Firstly try these plz: 1- clean the project up-root solution 2- close the visual studio 3- reopen vs and open the solution 4- build it. 5- totally remove the migrations folder under the entities folder 6- remove the table _projectnameMigrations from the DB 7- open the PMC in Vs 8- Enable-Migrations 9- Add-Migrations mig_Myinit 10- (!Important) clear the up method and make it empty 11- update-database 12- done Your next migrations... point is that if you remove a table manually from the database ef is not able to recognize it and by default it is accessible so when ur using ef you have to do any database-related tasks from the pmc.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.