hooks/syncschema.py
changeset 10025 7b72ecc3f4d2
parent 9971 5e44dd9dde6b
child 10074 ab956b780d4e
--- a/hooks/syncschema.py	Tue Nov 04 14:10:02 2014 +0100
+++ b/hooks/syncschema.py	Thu Nov 13 10:37:44 2014 +0100
@@ -449,9 +449,11 @@
             default = default.unzpickle()
         props = {'default': default,
                  'indexed': entity.indexed,
-                 'formula': entity.formula,
                  'fulltextindexed': entity.fulltextindexed,
                  'internationalizable': entity.internationalizable}
+        # entity.formula may not exist yet if we're migrating to 3.20
+        if hasattr(entity, 'formula'):
+            props['formula'] = entity.formula
         # update the in-memory schema first
         rdefdef = self.init_rdef(**props)
         # then make necessary changes to the system source database
@@ -505,7 +507,7 @@
             cnx.system_sql('UPDATE %s SET %s=%%(default)s' % (table, column),
                                {'default': default})
         # if attribute is computed, compute it
-        if entity.formula:
+        if getattr(entity, 'formula', None):
             # add rtype attribute for RelationDefinitionSchema api compat, this
             # is what RecomputeAttributeOperation expect
             rdefdef.rtype = rdefdef.name