In my CodeFirst application, local assemblies have the app.config flag, which means it is not in production. When I'm not in production, it completely destroys and recreates the database. Since my working database user does not have permission to delete the database, even if my web.config conversion is somehow skipped (thus EF is trying to recreate the database) my production database will not be deleted and an exception will be thrown instead .
My workflow is as follows:
- Check production branch of code with latest changes
- Fast smoke / regression testing (this should already be done before checking the code in the production branch, but just in case)
- Download the latest backup of my production database and install it on my local SQLEXPRESS server.
- Run Open DBDiff between the database created by my local code (although this is production code, since it locally recreates the database) against making the backup.
- Generated recall scripts and attempted run against production backup
- Assuming no errors have occurred, rewrite the database that the code generated by the production backup and do a production data test to ensure that all the data has remained intact;
- Run the scripts in a real production database.
Step # 2 automatically creates a new, clean database based on the latest data model, so I always know that I have an updated database in which there are no artifacts from development efforts that are not yet ready for production.
Kalldrexx
source share