You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by Robert Einsle <ro...@einsle.de> on 2005/10/21 13:19:19 UTC
Alter Database Question
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
Re: Alter Database Question
Posted by Robert Einsle <ro...@einsle.de>.
Hy Thomas,
Thomas Dudziak schrieb:
>Hi Robert,
>
>sorry for answering so late, but I was out-of-country for week.
>
>
no Problem, we have an Workaround, sorting the xml-File matching the
Foreign KEys.
>Anyway, could you perhaps open an issue with DDLUtils's JIRA for this
>and if possible attach some snippets (database layout, new schema XML)
>?
>
>
It's DDLUTILS-39 in Jira. I hope, you can help.
Thanks a lot.
>Tom
>
>
>
\Robert
Re: Alter Database Question
Posted by Thomas Dudziak <to...@gmail.com>.
On 10/21/05, Robert Einsle <ro...@einsle.de> wrote:
> 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?
Hi Robert,
sorry for answering so late, but I was out-of-country for week.
Anyway, could you perhaps open an issue with DDLUtils's JIRA for this
and if possible attach some snippets (database layout, new schema XML)
?
Tom