Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing Database-Agnostic Schema

We have a set of applications that work with multiple database engines including Sql Server and Access. The schemas for each are maintained separately and are not stored in text form making source control difficult. We are interested in moving to a system where the schema is stored in some text-based format (such as XML or YAML) with descriptions of field data types, foreign key relationhsips, etc.

When all is said and done, we want to have a single text file in source control that can be used to generate a clean database that works with both SQL Server, Access at least (and preferably is capable of working with Oracle, DB2 and other engines).

I'm certain that there are tools or libraries out there that can get us at least part of the way there. For one, I've found Altova MapForce that looks like it may do the trick but I'm interested in hearing about any alternative tools or libraries or even entirely different solutions for those in the same predicament.

Note: The applications are written in C++ and ORM solutions are both not readily available in C++ and would take far too long to integrate into our aging products.

like image 584
Karim Avatar asked Nov 06 '22 22:11

Karim


1 Answers

If you don't use a object relational mapper that does this (and many other things for you) the easiest way might be to whip up a few structures to define your tables and attributes in some form of (static) code and write little generators to create actual databases from that description.

That makes it easy for source control, and if you're careful when designing those structures, you can easily re-use them for other DBs if need arises.

like image 57
David Schmitt Avatar answered Nov 15 '22 06:11

David Schmitt