The following databases exist for each internally and independently developed software (web-based or client-server) application for a company:
- Development (D1 and D2)
- Integration
- Staging
- Testing
- Production
The Production environment is shared between applications.
Migrating applications requires:
- Run a script that changes the Production database for the new application version
- Deploy a new version of the software application
My questions:
- Is it acceptable for the Production database update script to contain ERRORs?
- Why or why not?
It is certainly unacceptable for the script to have unexpected errors in production. Just because it’s production and we want to be sure that everything is okay.
As for expected errors, that’s a matter of taste. Some DDL scripts look like this:
When this script is deployed as an upgrade into production the
createfails, because the table already exists. Provided that is expected I think that is acceptable. But undoubtably it muddies the script logfile, which makes it harder to check that the upgrade succeeded. That is why many people would prefer a separate patch script which just applies the delta, and so consists of statements which should succeed.edit
It certainly can be such an argument. Different rules apply when the person who wrote the maintenance scripts also runs them in production compared to projects where patches are applied by outsourced DBAs in a hosted environment. In this latter case clarity is paramount.