Closed lovexuan closed 1 year ago
The model definition seems like:
class MySQLTimestampField(TimestampField): field_type = 'timestamp' class Table1(Model): timestamp_field = MySQLTimestampField()
and the generated code seems like:
import peewee as pw ... @migrator.create_model class Table1(pw.Model): timestamp_field = pw.MySQLTimestampField()
When I execute router.run(), it raise AttributeError: module 'peewee' has no attribute 'MySQLTimestampField'.
router.run()
AttributeError: module 'peewee' has no attribute 'MySQLTimestampField'
The suggestion is, scan all the referenced fields first, and get module by class.__module__, then generate codes by this relation.
class.__module__
should be fixed in the latest versions
The model definition seems like:
and the generated code seems like:
When I execute
router.run()
, it raiseAttributeError: module 'peewee' has no attribute 'MySQLTimestampField'
.The suggestion is, scan all the referenced fields first, and get module by
class.__module__
, then generate codes by this relation.