I am considering writing a simple database application for my wife, but I’m hung up on good programming practice, and want to have a human readable source for storing the database schema.
Only, I don’t know of any tools for the job, and I can’t believe that they don’t exist—probably I just don’t know what to ask google, but I’m not finding them.
So, what libraries or other tools out there to support reading database schema from plain text files.
To invenetix’s question: I expect to generate the database creation code at build-time or to include the schema description in the release and build the database from the description at run-time. Draemon’s suggestion would be fine, but I don’t want to be locked into a predetermined RDBMS if I can help it.
Perhaps I should say that I’ve used databases in programming projects before, but never been responsible for the creation code.
Possible I’m over engineering the problem at this point.
Just use SQL. SQL is not only a query language but a DDL (data definition language). If, for example you are using mysql; you can design your schema however you want, run mysqldump which will create an SQL file with DDL statements. Tidy up the schema, then you can load the schema any time you like by sourcing the SQL file. Personally, I just write the SQL schema in a text editor and load it into mysql.
This will work for mysql, postgresql, oracle, and probably any other DB.