db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Francois Guitton" <fguit...@coemergence.com>
Subject Creating foreign key constraints on tables that already exists in the database
Date Fri, 17 Feb 2006 13:33:33 GMT
Hi

 

Is there a way with the generator to create new tables that have foreign key
that reference already existing tables?

 

E.g. I have a database where the tables Product  (primary key product_id)
and Client (primary key client_id) already exists. 

Now I want to use the generator to create a joined table Product_Client that
have two foreign keys

So my xml would look like

  <table idMethod="native" name="Product_Client">

    <column name="product_client_id" primaryKey="true" required="true"
type="INTEGER"/>

    <column name="product_id" required="true" type="INTEGER"/>

    <column name="client_id" required="true" type="INTEGER"/>

        <foreign-key foreignTable="Client">

            <reference foreign="client_id" local="client_id"/>

        </foreign-key>

        <foreign-key foreignTable="Product">

            <reference foreign="product_id" local="product_id"/>

        </foreign-key>

  </table>

 

Torque doesn't like it when generating the sql as it doesn't find the
referenced tables. Could there be an option in Torque where it just
generates a warning that the table does not exist but still create the sql?

 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message