Stack Exchange
Aerich "empty" migrations
Aerich doesnt generate migrations if model is changed. Example:
Model before:
class Order(BaseModel, UserMixin):
    """
    Base class for all orders
    Future orders are not supported yet
    """
    allowed_types = [OrderType.LIMIT, OrderType.MARKET,
                     OrderType.STOP_LOSS, OrderType.TAKE_PROFIT,
                     OrderType.STOP_LOSS_LIMIT, OrderType.TAKE_PROFIT_LIMIT,
                     OrderType.TRIGGER_ORDER, OrderType.LIMIT_MAKER]
    status = fields.TextField(default=OrderStatus.NEW)
    amount = fields.DecimalField(max_digits=36, decimal_places=18, default=0.0)
    pair = fields.ForeignKeyField("models.TradingPair")
    side = fields.TextField(default=OrderSide.BUY)
    price = fields.DecimalField(max_digits=36, decimal_places=18, default=0.0)
    type = fields.TextField(default=OrderType.MARKET)
    executed_amount = fields.DecimalField(max_digits=36, decimal_places=18, default=0.0)
    stop_price = fields.DecimalField(max_digits=36, decimal_places=18, default=0.0)
    trigger = fields.TextField(default=OrderSide.BUY)

Model after:
class Order(BaseModel, UserMixin):
    """
    Base class for all orders
    """
    allowed_types = [OrderType.LIMIT, OrderType.MARKET,
                     OrderType.STOP_LOSS, OrderType.TAKE_PROFIT,
                     OrderType.STOP_LOSS_LIMIT, OrderType.TAKE_PROFIT_LIMIT,
                     OrderType.TRIGGER_ORDER, OrderType.LIMIT_MAKER]
    status = fields.TextField(default=OrderStatus.NEW)
    amount = fields.DecimalField(max_digits=8, decimal_places=18, default=decimal(0))
    pair = fields.ForeignKeyField("models.TradingPair")
    side = fields.TextField(default=OrderSide.BUY)
    price = fields.DecimalField(max_digits=8, decimal_places=18, default=decimal(0),
                                null=True)
    type = fields.TextField(default=OrderType.LIMIT)
    base_asset_executed_amount = fields.DecimalField(max_digits=8, decimal_places=18,
                                                     null=True, default=decimal(0))
    quote_asset_executed_amount = fields.DecimalField(max_digits=8, decimal_places=18,
                                                      null=True, default=decimal(0))
    avg_price = fields.DecimalField(max_digits=8, decimal_places=18, default=decimal(0),
                                    null=True)
    stop_price = fields.DecimalField(max_digits=8, decimal_places=18, default=decimal(0),
                                     null=True)
    trigger_price = fields.DecimalField(max_digits=8, decimal_places=18,
                                        default=decimal(0), null=True)
    trigger = fields.TextField(default=OrderTrigger.IMMEDIATE)

Aerich doesnt detect model changes:
async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE "balances" ALTER COLUMN "uuid" SET;
        ALTER TABLE "currencies" ALTER COLUMN "uuid" SET;
        ALTER TABLE "orders" ALTER COLUMN "uuid" SET;
        ALTER TABLE "transactions" ALTER COLUMN "uuid" SET;
        ALTER TABLE "crypto_transactions" ALTER COLUMN "uuid" SET;
        ALTER TABLE "tax_transactions" ALTER COLUMN "uuid" SET;
        ALTER TABLE "trading_pairs" ALTER COLUMN "uuid" SET;
        ALTER TABLE "chains" ALTER COLUMN "uuid" SET;
        ALTER TABLE "wallets" ALTER COLUMN "uuid" SET;"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE "chains" ALTER COLUMN "uuid" SET;
        ALTER TABLE "orders" ALTER COLUMN "uuid" SET;
        ALTER TABLE "wallets" ALTER COLUMN "uuid" SET;
        ALTER TABLE "balances" ALTER COLUMN "uuid" SET;
        ALTER TABLE "currencies" ALTER COLUMN "uuid" SET;
        ALTER TABLE "trading_pairs" ALTER COLUMN "uuid" SET;
        ALTER TABLE "tax_transactions" ALTER COLUMN "uuid" SET;
        ALTER TABLE "transactions" ALTER COLUMN "uuid" SET;
        ALTER TABLE "crypto_transactions" ALTER COLUMN "uuid" SET;"""

But if i delete all migrations and generate init migration, it generated right
I tried to change TORTOISE_ORM config with models, now it looks like this
TORTOISE_ORM = {
    "connections": {"default": CONF.database.db_uri},
    "apps": {
        "models": {
            "models": ["aerich.models",
                       "exchange_backend.core.models.users",
                       "exchange_backend.core.models.orders",
                       "exchange_backend.core.models.balances",
                       "exchange_backend.core.models.transactions",
                       "exchange_backend.core.models.currencies",
                       "exchange_backend.core.models.wallets"],
            "default_connection": "default",
        },
    },
}

tortoise config from pyproject.toml:
[tool.aerich]
tortoise_orm = "exchange_backend.core.models.db_config.TORTOISE_ORM"
location = "./migrations"
src_folder = "./."

UPD
If i change decimal places to 8, migrations generated correctly
