Do not constrain deferred fields in SQLAlchemy bridge
This commit is contained in:
parent
574c80be49
commit
3374e8c812
1 changed files with 4 additions and 3 deletions
|
@ -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):
|
||||
|
|
Reference in a new issue