[sync schema] take care rdef may not be final, in which case we want to use type of eid attribute stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 29 Sep 2010 12:16:28 +0200
branchstable
changeset 6359 0bff5a05385c
parent 6358 22c95c5ef12d
child 6360 1edfc0f3bb1d
[sync schema] take care rdef may not be final, in which case we want to use type of eid attribute
server/sources/native.py
--- a/server/sources/native.py	Wed Sep 29 12:15:10 2010 +0200
+++ b/server/sources/native.py	Wed Sep 29 12:16:28 2010 +0200
@@ -141,7 +141,11 @@
     """return backend type and a boolean flag if NULL values should be allowed
     for a given relation definition
     """
-    coltype = y2sql.type_from_constraints(dbhelper, rdef.object,
+    if rdef.object.final:
+        ttype = rdef.object
+    else:
+        ttype = 'Int' # eid type
+    coltype = y2sql.type_from_constraints(dbhelper, ttype,
                                           rdef.constraints, creating=False)
     allownull = rdef.cardinality[0] != '1'
     return coltype, allownull