pythonpython-3.xtortoise-orm

Tortoise ORM create custom index. Problem with aerich migration


I create a custom index UniqueIndexWithCondition. Run this command

aerich migrate --name initial_commit

response:

AttributeError: 'UniqueIndexWithCondition' object has no attribute 'index_name'

code example: my custom index

class UniqueIndexWithCondition(Index):
    ...

Solution

  • Just redeclare a index_name(self, *args, **kwargs)