Source Control and Database Per Tenant
CMTietgen
Posts: 2 New member
We have a website that uses a database per tenant (almost 200 in total) and 99% of the database objects between all tenants are the same, but some tenants have custom stored procedures.
What would be the best practice to version our databases?
Should we create a single database and put all objects in this database and make changes and commits against it? How would we handle the custom SPs for tenants? Would/should they be kept in their own branch?
What would be the best practice to version our databases?
Should we create a single database and put all objects in this database and make changes and commits against it? How would we handle the custom SPs for tenants? Would/should they be kept in their own branch?
Tagged:
Answers
However, if you are stuck with it, I would include all the sprocs in DEV/source control and I'd ensure there was some sort of naming convention that allows you to filter them all out at deployment time. Hence, all the standard tenants get the basic image without any custom sprocs.
Then I would add a post deploy script that does an (if exists) drop and redeploy on the specific sprocs depending on the tenant. If you have a sensible naming convention you might be able to make that post deploy relatively straightforward.
We had a similar problem with one of our customers. You can watch/read about it here:
http://dlmconsultants.com/greentube/
DevOps Mentor and Coach
Director of DLM Consultants
Creator of Speaking Mentors
Microsoft Data Platform MVP
Friend of Redgate
Twitter / LinkedIn
Script deployment is a pain now, though, since it they have to be deployed on 200+ customers.
I'll take a look at your video and see what you guys did, but if I can ask, were you using the database per tenant and did you switch up to something else?
DevOps Mentor and Coach
Director of DLM Consultants
Creator of Speaking Mentors
Microsoft Data Platform MVP
Friend of Redgate
Twitter / LinkedIn