Do not constrain deferred fields in SQLAlchemy bridge

This commit is contained in:
Jake Moshenko 2015-11-17 15:55:18 -05:00
parent 574c80be49
commit 3374e8c812

View file

@ -48,10 +48,11 @@ def gen_sqlalchemy_metadata(peewee_model_list):
alchemy_type = Text
elif isinstance(field, ForeignKeyField):
alchemy_type = Integer
target_name = '%s.%s' % (field.to_field.model_class._meta.db_table,
field.to_field.db_column)
col_args.append(ForeignKey(target_name))
all_indexes.add(((field.name, ), field.unique))
if not field.deferred:
target_name = '%s.%s' % (field.to_field.model_class._meta.db_table,
field.to_field.db_column)
col_args.append(ForeignKey(target_name))
elif isinstance(field, BigIntegerField):
alchemy_type = BigInteger
elif isinstance(field, IntegerField):