commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r5745 - trunk/gnue-appserver/src/classrep


From: johannes
Subject: r5745 - trunk/gnue-appserver/src/classrep
Date: Tue, 20 Apr 2004 04:35:36 -0500 (CDT)

Author: johannes
Date: 2004-04-20 04:35:35 -0500 (Tue, 20 Apr 2004)
New Revision: 5745

Modified:
   trunk/gnue-appserver/src/classrep/SchemaSupport.py
Log:
Use isReference and referencedClass for foreign keys


Modified: trunk/gnue-appserver/src/classrep/SchemaSupport.py
===================================================================
--- trunk/gnue-appserver/src/classrep/SchemaSupport.py  2004-04-20 09:28:38 UTC 
(rev 5744)
+++ trunk/gnue-appserver/src/classrep/SchemaSupport.py  2004-04-20 09:35:35 UTC 
(rev 5745)
@@ -235,9 +235,8 @@
       if not cProp.gnue_nullable is None and not cProp.gnue_nullable:
         field.nullable  = False
 
-      # if a type has an underscore we assume it's a reference-type, which
-      # means to create a foreign key reference to the gnue_id of that class
-      if "_" in cProp.gnue_type:
+      # create a foreign key for reference-properties
+      if cProp.isReference:
         constraint = Objects.GSConstraint (constraints)
         constraint.name = "%s_%s_fk" % (aClass.table, cProp.column)
         constraint.type = "foreignkey"
@@ -247,7 +246,7 @@
 
         constRef = Objects.GSConstraintRef (constraint)
         constRef.name  = "gnue_id"
-        constRef.table = cProp.gnue_type
+        constRef.table = cProp.referencedClass.table
 
     # in create-mode look if a primary key could be constructed
     if create and aClass.properties.has_key ('gnue_id'):





reply via email to

[Prev in Thread] Current Thread [Next in Thread]