title: Lost migrations and Azure database is now out of sync
body: <p>The quick question is &quot;How do I get my Azure database back in sync with my local database?&quot;</p>
  <p>Details:
  I have been using entity framework in my project, which really not that different from the ASP.NET MVC 5 sample project, which has Identity 2 built in.</p>
  <p>There are two database contexts, one called ApplicationDbContext (aspnet_somethingUserDB) from Identity and the other one called StoreInitialTestContext (store_db) that is from my changes.</p>
  <p>Interestingly, I have each of these contexts in a separate SQL database locally, and they are in just a single database, called store_db on the Azure service.</p>
  <p>Things were working swimmingly, and the two local databases, which had the same table complement together as the single database on Azure, were in sync.  The website worked well locally for debugging and on Azure.</p>
  <p>After making a last change to the schema by adding a model, I did the update-database command and the local database was updated.  Unfortunately, when I published the website to Azure, after selecting the context and the checkmark by &quot;run code-first migrations...&quot;, the Azure database didn't update.</p>
  <p>Looking at my code, I don't see any migrations that are pending, so I'm not sure how I get the Azure database back in sync.</p>
  <p>As a last-ditch effort, I set my Azure database from Basic to Standard, and used the compare schema command between my local store_db and the Azure store_db.  I made sure that only tables in the local store_db were updated by unchecking the tables having to do with aspnet_UsersomethingDb.</p>
  <p>That operation wasn't successful, so I attempted to undo the changes to the local which were the problem, and which didn't get applied on Azure.</p>
  <p>That too wasn't successful, so I adjusted my website to avoid the EntityFramework &quot;model vs database differences&quot; crash so that it would at least limp along.</p>
  <p>At this point, my local database is fine, but turning off the &quot;code first migrations&quot; checkbox, the Azure database is reporting:</p>
  <blockquote>
  <p>An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was
  not handled in user code</p>
  <p>Additional information: The model backing the 'StoreInitialTestContext' context has changed since
  the database was created. Consider using Code First Migrations to update the database
  (<a href="http://go.microsoft.com/fwlink/?LinkId=238269" rel="nofollow noreferrer">http://go.microsoft.com/fwlink/?LinkId=238269</a>).</p>
  </blockquote>
  <p>Turning on the checkbox, the report is:</p>
  <blockquote>
  <p>An exception of type 'System.Data.SqlClient.SqlException' occurred in EntityFramework.dll but was
  not handled in user code</p>
  <p>Additional information: There is already an object named 'ExtendedUserInformations' in the
  database.</p>
  </blockquote>
  <p>This seems to indicate that code-first migrations want to add the object to get things in sync, but that the object already exists.</p>
  <p>Is there just a quick way to get these databases in sync?  There is not that much data in Azure, so if I have to, I can export some records and reload them after recreating the db.</p>
  <p>Do you recommend using update-database and specifying the Azure connection string?</p>