Stored Procedures in Source Control System
I am using VS 2010. We use stored procedures for data access. What is the best way to keep the stored pro开发者_StackOverflow中文版cedures in source control so we will know who changed the stored procedure and what got changed?
The best way for someone using VS2010 would probably be the database project (available only in VS2010 Premium and Ultimate). This project can inspect an existing database and create individual files from individual database objects (tables, constraints, indices, sprocs, etc.). Then you can check the whole project into your source control, then you get all the benefits of source control applied to your database as you do with other code files you check into source control.
Red Gate also has a source control for database you might want to check out.
We define the whole database in an XML file with a defined XML Schema. That file can then be checked into any SCS. The other advantage is the schema includes field and table documentation. Using some XSL transforms we can create a script to build the database or a data dictionay in HTML that documents the database.
We just put them into .sql text files and put them into SVN. It's simple at least!
精彩评论