views:

321

answers:

3

We have a database that persist our metadata and data.

Our metadata is produced buy a dedicated team, using a Web application on the development server, and is a critical part of our application.

Then the customer generates data according to this metadata.

We already version the database schema, and all schema change. The next step is to put our metadata under version control.

Naive solution

A naive solution would be to dump all the metadata, and commit it under version control before generating the corresponding packages. Since it's a dump, it can easily be restored. But there is probably a better way, like an incremental solution (only version diffs).

Text dumps

Another solution is to export all metadata tables in text format (like XML), and then version those text files. But then you have to find a way to reimport them.

So, is your metadata under version control? Why? How?

+1  A: 

Non Niave solution:-

Version control your mata data build scripts.

I.E. the database schema drop/create and the SQL "INSERTS" should both be placed under version control.

The advantage of this approach is thet the Schema and Insert scripts really are source code. Version controls systems are designed for source code so they play well with this method. In addition its pretty much self contained and can be easily ported to other systems.

If your meta data is devleoped interactivley there are several utilities that will allow you to export your database as an insert script.

James Anderson
Can you name one of those utilities that allow us to export the database as an insert script?Thanks.
Nelson Reis
Each brand of database provides its own tool. E.g. for MySQL, it's `mysqldump`.
Bill Karwin
TOAD for Oracle, or Squirrel SQL for anything that supports a JDBC connection.
James Anderson
This is what we do, only we write the insert statements first, put them in version control and then include them (sadly not automatically) into the upgrade database script. Bonus points for using merge/upsert to make subsequent updates easy.
WW
+1  A: 

Something to consider would be the tools available by Embarcadero. ErStudio for example provides the ability to version control against your entire database model.

skamradt