Database scripts version control process/strategy?
-
I am looking for methodologies or strategy or process that makes database version control possible. Kindly share what you follow in your projects
-
I am looking for methodologies or strategy or process that makes database version control possible. Kindly share what you follow in your projects
One way to approach this is to have a create a baseline set of scripts which created all of your DB objects: Tables, Indexes, Triggers, Stored Proc, etc. Check those scripts into a version control system () along with your source code. (Make a folder called "SQL" or something) As you revise your application, create ALTER scripts for the DB objects (Tables, Indexes, Triggers, Stored Proc, etc) which will take the database from State A to State B. Use some type of naming convention which will show the progress from one version to another. "ALTER_tables_1.0.0_to_1.0.1" When you get to a major release of the software, such as v2.0.0, then Re-Create the CREATE DB object scripts which will include all of your ALTER scripts; this way you don't have to keep rolling up schema changes. ALSO: Take into consideration that you may need Data Manipulation scripts to "seed" some of your tables with basic data. Handle those scripts with something like ALTER_Data_1.0.0_to_1.0.1 Just giving you some ideas, not completely thought out, but I remember doing something like on previous projects. BTW: I use Subversion / SVN / Tortoise as version control for myself.
-
I am looking for methodologies or strategy or process that makes database version control possible. Kindly share what you follow in your projects
There are lots of 3rd party products that can source control your database. This is one of them that I have used, SQL source control | ApexSQL[^]
Social Media - A platform that makes it easier for the crazies to find each other. Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.