We use MS SQL Server and C #. Our database is under control, and I will tell you some details of our implementation. We performed two operations:
Export database to text files. Database schema files: tables.sql relationships.sql views.sql ... and table contents files: Data / table 1.txt Data / table2.txt ... It is easy to view database changes using source control logs, since all of these files are in text format. Implementation is based on classes from the Microsoft.SqlServer.Management.Smo namespace.
Import the database from these text files. The implementation is quite simple - just execute sql commands from * .sql files, and then do a bunch of inserts.
So, we have two bat files: create-test-databse.bat and export-test-database.bat. When a developer needs a new test database, he simply runs the bat file and waits a minute. Each functional test that needs a database creates a new database, uses it, and then kills. But I have to say that this is not a very fast operation. :(
So what tools do you use to put your database under source control? I mean, how do you implement the operations "create a test database" and "export a test database", for example?
source
share