From e82982d25ddf7f851cdfd5ebe9ddf3b11d2c6c50 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Fri, 31 Aug 2012 13:32:22 -0500 Subject: [PATCH] fixed problem with case in migrations --- VERSION | 2 +- gluon/dal.py | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index ea3f1b21..453b4385 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.3 (2012-08-31 11:08:15) stable +Version 2.0.3 (2012-08-31 13:32:07) stable diff --git a/gluon/dal.py b/gluon/dal.py index 3eb0d9e3..7ff96910 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -943,7 +943,8 @@ class BaseAdapter(ConnectionPool): if not isinstance(v,dict): v=dict(type='unkown',sql=v) return k.lower(),v - ### make sure all field names are lower case to avoid conflicts + # make sure all field names are lower case to avoid + # migrations because of case cahnge sql_fields = dict(map(fix,sql_fields.iteritems())) sql_fields_old = dict(map(fix,sql_fields_old.iteritems())) sql_fields_aux = dict(map(fix,sql_fields_aux.iteritems())) @@ -993,10 +994,11 @@ class BaseAdapter(ConnectionPool): query = ['ALTER TABLE %s DROP %s;' % (tablename, key)] metadata_change = True elif sql_fields[key]['sql'] != sql_fields_old[key]['sql'] \ - and not isinstance(table[key].type, SQLCustomType) \ - and not table[key].type.startswith('reference')\ - and not table[key].type.startswith('double')\ - and not table[key].type.startswith('id'): + and not (key in table.fields and + isinstance(table[key].type, SQLCustomType)) \ + and not sql_fields[key]['type'].startswith('reference')\ + and not sql_fields[key]['type'].startswith('double')\ + and not sql_fields[key]['type'].startswith('id'): sql_fields_current[key] = sql_fields[key] t = tablename tt = sql_fields_aux[key]['sql'].replace(', ', new_add)