Basically, I followed the initial setup so I had a migration for Initial Create. In this setup, I had created a class. In this area, I am not sure exactly how to replicate what I ended up with. Somehow I ended up with the migration scripts for creating the initial ASPNET tables but not my class (MyForm).
I continued to use add-migration with no luck. It will not attempt to create the table. The up/down methods are always empty. I am not exactly sure where it stores the information that it has already attempted to generate MyForm. I looked inside the script for InitiateCreate but I do not see the class or table in there.
Next I tried to make a modification, and this did generate an add column. Because I do not have the table, this update failed. Just to test it further, I also created another class. This also generated scripts for creating a table. Of course this failed, because the other update to add column is still pending.
After several more hours of banging my head, I finally decided to start over. This posed another set of problems. I quickly found this link which gave me the command (Update-Database -TargetMigration:0).
When I tried to add-migration again, I get the error that I still had pending migrations. I tried to look everywhere on how the system knows that I still had pending migrations. I just took a risk and just deleted the migration files in the Migrations folder. Initially, I had moved them to a backup folder but of course the project would still find it since it is in the same namespace. I guess I could have just dropped them from the project. Fortunately, by running add-migration, I was able to recreate the Initial Create scripts again.
Also another problem with the tutorials were that they were all using Visual Studio 2012 or 2010, while I am using 2013 Express. Some of the layouts and forms were slightly different. Because my problem was a bit unique, these slight differences really made me question a lot more than I should have. It would be nice if there were tutorials on how to make a blanket rollback without restarting a new project.
Error Messages
- "Unable to generate an explicit migration because the following explicit migrations are pending"
- object does not exist
No comments:
Post a Comment