We are overhauling the way that we store our database in source control and keep a change log of it. I was reading the following article: http://thedailywtf.com/articles/Database-Changes-Done-Right, and in the Short Section of "The Taxonomy of Database Scripts" it describes the three types of scripts (QUERY, OBJECT, and CHANGE). I like the idea of generalizing scripts into these three categories but I'm wondering about the QUERY type. Questions:
- Why would someone want to put a SELECT statement into source control outside of an object?
- The database will change afterwards and make the QUERY script unusable, what then?
- The data may change returning a different result set, this would defeat purpose of source control, what then?
- Would the original result set have to be saved to solve the 2nd and 3rd issues?
- What is an example of a SELECT statement that might be put into source control?
- Wouldn't a INSERT statement work better and store the results in a table as in baselines?
I just can't see the purpose of storing SELECT statements into source control.
If there is a purpose could someone please answer the above questions and maybe state the pros and cons of storing a SELECT statement into source control?