[Devel] database setup scripts

Henning Westerholt henning.westerholt at 1und1.de
Tue May 15 14:04:13 CEST 2007


On Freitag, 11. Mai 2007, Henning Westerholt wrote:
> [...]
Hi there,

some more details:

The db schemas source of the tables are in XML format in the db/schema dir, 
you need only one schema for mysql, postgres, dbtext (and oracle, deactivated 
at the moment). This format of the files is fairly simple to understand and 
to extend in my opinion.

You can call "make" in the db/schema dir to generate four tables for core,   
extra, serweb and presence for all databases. It is possible to edit the e.g. 
openser-core.xml file to get only the tables for core generated you really 
want. For the generation you'll need the xsltproc function, but this should 
be not a problem, as you probably already have all these docbook-xml stuff 
installed.. The tables are copied into the scripts/$dbname directory.

It is also possible to generate docbook documentation from the XML schema 
files, i included a (untested) script for these task.

In the database setup script in the script dir i plan to simply pipe the 
generated tables into the sql_query function. I allready did some tests, this 
works good with some extensions in this function. After removal of the sql 
code the scripts should be then fare more shorter and extensible.

For now i move some variables (TABLE_TYPE; USERCOL..) into the xml 
file "entities.xml", as i don't like to play with sed and friends now. 
Especially USERCOL is needed in the script too, i don't have a good solution 
for this at the moment. 

In the directory doc/dbschema are the DTD and XSL files for the table 
generation located. I agree, XSL is not really pretty, but this the right 
tool for these kind of jobs. I allready did some extensions to the SQL 
generation, with some documentation this is not so hard to do. The 
alternative would be to write all this stuff from the scratch e.g. in a 
script language, and this would in my opionion a symptome of NIH. ;-)

As i wrote in my last e-mail, this already works for four tables, i haven't  
checked the database output for other databases as mysql yet. 

Cheers,

Henning



More information about the Devel mailing list