Closed gmblogref closed 11 years ago
Search google for "entity framework code first migrations". Essentially, you need to open the package manager console and type "Update-Database" (or Upgrade-Database... I can't remember which).
Steve
Sent from my iPhone
On Jun 8, 2013, at 5:16 PM, Geoff Blogref notifications@github.com wrote:
Got this to work in the test SRC.
Moving it over to the SRC2 first I get this: Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration
If I set AutomaticMigrationsEnabledto true I get this: There is already an object named 'webpages_Membership' in the database.
Trying to remember what I did differently in SRC VS. SRC2. I moved all the code over and didn't mess with the database context in SRC when I added the code.
— Reply to this email directly or view it on GitHubhttps://github.com/geekpgh/mastersproject/issues/45 .
I tried that before and that is where I got the same errors the second time. I am just creating a model for webpages_Membership so I can use it in the recover password code. I am not trying to make changes to it at all. I will keep searching. If you want to see the code it is in the SRC version and working.
Found the answer. When creating the migration just comment out the code in override of Up and Down. http://christesene.com/entity-framework-4-3-code-first-with-automatic-migrations/
Got this to work in the test SRC.
Moving it over to the SRC2 first I get this: Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration
If I set AutomaticMigrationsEnabledto true I get this: There is already an object named 'webpages_Membership' in the database.
Trying to remember what I did differently in SRC VS. SRC2. I moved all the code over and didn't mess with the database context in SRC when I added the code.