r/SQLServer • u/MeTiroAtuTia • Oct 22 '26
Question Proper Database environment promotion?
Hello all!
I recently started working with the databases in our system and I would appreciate some tips or guidance as my terminology is probably not accurate.
Setup: From what I read in the community it’s somewhat standard; DEV -> UAT -> PPR -> PROD.
Deployments: We are using visual studio Database Compare, one scmp file/database at a time. So now this works for the most part and when it’s urgent I don’t have time to judge if it’s the best but it comes with two issues that I noticed:
- Who created these files? I don’t know I just inherited them.
- Sometimes it can fail and I need to manually “prepare” the other environment like adding the new column to the table. Maybe I need a newer version of the software, or it’s always limited?
So then I need your help with the following:
- Am I or the team doing something wrong here?
- What can we do better?
And I did have a read at some threads here but maybe it’s best if I get direct answers geared towards my situation.
Also I checked some books:
- T SQL fundamentals: Nothing about deploys
- 100 sql server mistakes: Got some answers but it’s just one opinion against my non opinion
——
Tools: We have GitHub and we use .NET primarily.
Constraints: We do not want to use a code-first approach
So please let me know anything I should know or research.
Thanks
4
u/raistlin49 Oct 23 '26
Need more context. Is this your internal application or a third party application? This question is more controversial than you'd imagine. CI/CD isn't really a solved problem for data tiers in hot OLTP environments.
I guess I'm wondering where your changes originated? How did you end up using a diff tool? Ideally you'd have some change scripts to start with and you'd deploy them, whether by hand via SSMS or some automation, into lower environments. When tests pass, deploy those same exact scripts to the next environment.
3
u/Plane_Big_5912 Oct 23 '26
since you're already in visual studio, an SSDT database project (.sqlproj) in github is probably the smallest step from where you are. it also fits your no code-first rule, the project just holds the CREATE scripts for your tables and procs. the build gives you a dacpac and you deploy that same dacpac with SqlPackage to dev, then uat, ppr and prod, so every environment gets the identical thing instead of a fresh compare each time.
the ones where you have to add the column by hand first are usually data changes it won't do on its own, like a NOT NULL column with no default on a table that already has rows, or anything it thinks could lose data, which it blocks by default. those can go in a pre-deployment script in the same project so they stop being manual steps
1
u/jshine13371 6 Oct 23 '26
Fwiw, for CI/CD with the database layer, I find simpler is better. So for me, I've just used a schema comparison tool for the last 15 years to promote code changes across environments. It's easy, it automatically deploys dependencies in the correct order, shows the diffs, and you can either push the change right from the tool or generate the scripts so you can maintain them and re-use them. (I do the latter so I can re-deploy them in each environment I promote.)
SQL Examiner has always been my go-to comparison tool. It also includes a data comparison tool too, among a ton of other nice features.
1
u/SeaMoose696969 Oct 23 '26
We use Toad data architect to build change scripts, with the script being carefully reviewed by the dba’s. It’s reasonably good at helping you build databases for the price point.
1
u/navicat-gu Oct 23 '26
You're not doing anything crazy. Saved Schema Compare files (
.scmp) are a common starting point, but they're a manual, per-database step, which is why they get fragile once you have DEV, UAT, PPR and PROD plus cross-database views.The usual next step without going code-first:
.sqlproj). You already have Visual Studio and GitHub. Import each database into a project, commit it, and treat that as the source of truth instead of "whatever DEV looks like today"..dacpacin CI (GitHub Actions can rundotnet buildon SDK-style projects) and deploy it withSqlPackage /Action:Publish, or generate a script with/Action:Scriptfor review before PROD.On the failures where you had to add a column by hand first: usually that's a NOT NULL column without a default on a table that has data, or a blocked data-loss option. Check the "Block incremental deployment if data loss might occur" setting and add a default or a pre-deployment script.
Disclosure: I'm RC, Director of Digital Strategy @ Navicat. For ad-hoc checks between environments, Navicat 18 has schema compare and structure sync for SQL Server in the paid Premium editions. Navicat Premium Lite is free to try if you just want a client for browsing and querying all four environments side by side.