tortoise / aerich

A database migrations tool for TortoiseORM, ready to production.
https://github.com/tortoise/aerich
Apache License 2.0
841 stars 95 forks source link

Problem with field extention #146

Open vadim-shadrin opened 3 years ago

vadim-shadrin commented 3 years ago

I tried to extend field according to documentation. https://tortoise-orm.readthedocs.io/en/latest/fields.html#extending-a-field But aerich.utils.get_tortoise_config() rised en exception. Error: No config named "config.aerich" I do not understand why? In other cases this method called and it does not rise an exception ?

long2ice commented 3 years ago

Could you show full code?

vadim-shadrin commented 3 years ago

from tortoise.fields import CharField from tortoise import fields from tortoise.models import Model

class FileField(CharField): pass

class Image(TimestampedMixin, Model): id = fields.IntField(pk=True) width = fields.IntField() height = fields.IntField() file = fields.CharField(max_length=255) test = FileField(max_length=64)

vadim-shadrin commented 3 years ago

If clear database and all migrations every thing is ok. The field created.