# HG changeset patch # User Sylvain Thénault # Date 1449679457 -3600 # Node ID 53820b08a723a98e008870039d7dd1949ad1856a # Parent 2973522a192448409108c66063103b5856336daa [migration] only define variable if needed diff -r 2973522a1924 -r 53820b08a723 server/schema2sql.py --- a/server/schema2sql.py Thu Dec 17 17:14:08 2015 +0100 +++ b/server/schema2sql.py Wed Dec 09 17:44:17 2015 +0100 @@ -219,11 +219,12 @@ """return a sql type string corresponding to the constraints""" constraints = list(constraints) unique, sqltype = False, None - size_constrained_string = dbhelper.TYPE_MAPPING.get('SizeConstrainedString', 'varchar(%s)') if etype == 'String': for constraint in constraints: if isinstance(constraint, SizeConstraint): if constraint.max is not None: + size_constrained_string = dbhelper.TYPE_MAPPING.get( + 'SizeConstrainedString', 'varchar(%s)') sqltype = size_constrained_string % constraint.max elif isinstance(constraint, UniqueConstraint): unique = True