Hy List,
i'm using ddl-utils for short time, but we have one problem using ist.
We're developing an Rich Client Application, and i will use DDL-Utils to
automatically alter the Databases. While testing on an
Postgres-Database, we have the Problem DDL-Utils works thrait throu the
xml-Inputfile, and alters the Database. But we have an definition of an
foreign key insertet in an table above the creation-rule of the table
itself. So, DDL-Utils first tries to alter the Database, inserting the
Foreign-key, fails, then creates the table. So, we have 2 choices,
sorting the xml-inputfile for the foreign keys, or DDL-Utils let to
create foreign keys after creating the needed Tables. For my choices i
would prefer the second solution. Can i do anything other?
Thanks for help.
The xml-file:
--- cut ---
...
<table name="einsaetze">
<column name="obj_id" primaryKey="true" required="true"
type="INTEGER" size="4" default="0" />
<column name="verw_obj_id" primaryKey="false" required="false"
type="INTEGER" size="4" />
<column name="einsort_obj_id" primaryKey="false" required="false"
type="INTEGER" size="4" />
<column name="einsart_obj_id" primaryKey="false" required="false"
type="INTEGER" size="4" />
<column name="eins_kz" primaryKey="false" required="false"
type="VARCHAR" size="12" />
<column name="a_datum" primaryKey="false" required="true"
type="TIMESTAMP" size="8" />
<column name="e_datum" primaryKey="false" required="true"
type="TIMESTAMP" size="8" />
<column name="beschreibung" primaryKey="false" required="false"
type="VARCHAR" size="50" />
<column name="einsatz_leistung" primaryKey="false"
required="false" type="NUMERIC" size="10" />
<column name="memo_obj_id" primaryKey="false" required="false"
type="INTEGER" size="4" />
<foreign-key foreignTable="verwendungsarten">
<reference local="verw_obj_id" foreign="obj_id"/>
</foreign-key>
<foreign-key foreignTable="einsatzorte">
<reference local="einsort_obj_id" foreign="obj_id"/>
</foreign-key>
<foreign-key foreignTable="einsatzarten">
<reference local="einsart_obj_id" foreign="obj_id"/>
</foreign-key>
</table>
<table name="einsatzorte">
<column name="obj_id" primaryKey="true" required="true"
type="INTEGER" size="4" default="0" />
<column name="eins_ort_kz" primaryKey="false" required="false"
type="CHAR" size="12" />
<column name="strecken_len" primaryKey="false" required="false"
type="NUMERIC" size="10" />
<column name="strecken_len_einh" primaryKey="false"
required="false" type="CHAR" size="8" />
<column name="memo_obj_id" primaryKey="false" required="false"
type="INTEGER" size="4" />
</table>
<table name="einsatzarten">
<column name="obj_id" primaryKey="true" required="true"
type="INTEGER" size="4" default="0" />
<column name="eins_art_kz" primaryKey="false" required="false"
type="CHAR" size="12" />
<column name="memo_obj_id" primaryKey="false" required="false"
type="INTEGER" size="4" />
</table>
...
--- cut ---
on first time, we created the database without the "einsatzarten"
definition, let ddl-utils create the database, and then we added the
"einsatzarten" definition with the foreign key from "einsaetze" into the
xml-file. Then let ddl-utils alter the database. At first time,
ddl-utils create the database einsatzarten, with the primary key, but
without the foreign key. after an second run, it adds the foreign key.
Thanks a lot.
\Robert