2

In software development, there are a series of stages that it will goes through - Dev, Test, UAT, Staging, Demo and Production.

This is what I feel is correct, after reading/researching through the Internet.

Database development

  1. Dev the database in a separate DB (with same version as the prod and using only test data)
  2. Test the dev database (with same version as the prod and using only test data)
  3. Roll out to prod database

My questions are:

  1. Am I correct on the above database development stages?
  2. Is there an equivalent of UAT/Staging/Demo in database development?
  3. If point 1 is correct, how do people create/work on the dev/test database and ultimately pushing it to prod database?

P.S: I am new to database so please go easy on me! Thank you!

2 Answers 2

2

For database development you can choose to have as many of the same environments you'd normally use for application software development. Most people probably don't have all six separate environments you've listed above (even with regular application software development) but it's pretty common to minimally have a DEV, STAGING, and PROD environment. Some people opt for provisioning a UAT environment as well.

  1. Am I correct on the above database development stages?

More or less that's correct. The only minor thing I'll correct is the version in DEV is always greater than or equal to the version in PROD. Naturally if a developer makes a change to the database in DEV, it is now a newer version than the PROD database. Sure, that change can be undone in DEV, but DEV should never be a version older than PROD, just by the very fact that changes should only be made in DEV first, then deployed to any intermediary environments, and finally deployed to PROD last.

  1. Is there an equivalent of UAT/Staging/Demo in database development?

Yes, those are the equivalents. Any of those are acceptable environments to have, if you decide on them in your deployment workflow.

  1. If point 1 is correct, how do people create/work on the dev/test database and ultimately pushing it to prod database?

There's various ways to manually and automatically manage deployments and refreshes between environments. It just depends on your business requirements and the database system you're using.

Currently I support a DEV, STAGING, and PROD environment. My workflow is to make changes in DEV and track which objects I've changed. When I'm ready to move the current version of DEV up to STAGING, I run a set of scripts that refresh STAGING from the latest backup of the PROD database. Those scripts also make appropriate data obfuscations and changes that are specific to the STAGING environment. (The scripts are all part of a database job I've created so I only have to push one button to refresh STAGING from PROD.)

After STAGING is refreshed from PROD, I then use a schema migration tool (called SQL Examiner) to compare the DEV and STAGING database for differences and automatically generate the migration scripts from DEV to STAGING.

I then run these scripts in my STAGING environment and hand off the correlating STAGING application to the appropriate users for testing. Once they accept the changes are PROD ready, I lock those scripts down in source control so they are ready for the day we deploy to PROD. At this point, further changes can be made in DEV without worry of them colliding with the locked version that's ready for PROD. They'll all be part of future release candidates.

Then when it's time to deploy to PROD, we run the exact same scripts in the same manner that we ran in our STAGING environment. Now PROD is caught up to that version from DEV.

The key in all of this is the STAGING environment which is a handshake between DEV and PROD. It is one that can be updated from either direction with the least amount of care. It is continually maintained by either a refresh from the PROD environment and / or a deployment from the DEV environment. This creates a good workflow of ensuring proper version migration and testing across all environments.

2
  • Thanks J.D. for your insights on this. When you mentioned correlating STAGING application to the appropriate users for testing, are the users here the one who manages and maintain the production database (I am under the impression that person A will manage on DEV and STAGE, and there is a person B who manages PROD in a real world setting).
    – SunnyBoiz
    Commented Aug 9, 2022 at 7:17
  • @SunnyBoiz The users in my case are the end users. Our STAGING environment is where we do our user acceptance testing. They tell us if the changes are acceptable to be released for PROD or not.
    – J.D.
    Commented Aug 9, 2022 at 12:20
2

On a side note: there is a saying that GUI changes most often, businesses logic second and database changes the least often.

This would imply that a lot of databases use "oldish" technology (in comparison to e.g. front-end) and it would also explain why organisation/processes are less well and thoroughly defined.

With the professionalisation in modern data storage industry, this might have changed and is now truly just an (old) "meme".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.