title: How does EF 4 code first handle schema changes in a production environment?
body: <p>Traditionally I have always written my sql scripts by hand so they are nice and clean (I'm not a fan of the generated ones) and release to release, I provide a fresh install script and a migration script from the previous version that creates new tables, alters existing tables etc. This is all pretty standard.</p>
  
  <p>I haven't really had much time to play around with EF 4 code first but am quite interested to use it if it is actually viable in a production environment.</p>
  
  <p>Say you have a code first approach where a database will automatically be created if one does not exist. What happens if you release a new version of the software which has schema/model changes. Is EF smart enough to update the database schema to match the updated EF model?</p>
  
  <p><strong>Scenario</strong></p>
  
  <ol>
  <li>Client installs asp.net MVC website on their server. Upon first run, a fresh database is created</li>
  <li>Client uses website for a while and the database gets populated with some data</li>
  <li>Meanwhile a new version of the website is released and the EF model has changed</li>
  <li>Client downloads new version, deploys website and points to existing database</li>
  </ol>
  
  <p><strong>Is code first only useful for initial deployment, or is it smart enough to update an existing database release to release like this?</strong></p>