tortoise / aerich

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

varchar max_length change not detected #317

Closed pawelkoston closed 10 months ago

pawelkoston commented 10 months ago

Example:

field = fields.CharField(max_length=1, null=True, default=None,)
aerich init-db

Change length

field = fields.CharField(max_length=2, null=True, default=None,)
aerich migrate; aerich upgrade;

The field length stays 1 but should be 2

alexf-bond commented 10 months ago

Did you try running aerich upgrade after the init-db to get the latest snapshot / version in the aerich table? I know generally when making changes the flow is: aerich upgrade -- get the current state of the migrations applied make necessary model changes aerich migrate -- detect and generate any new migrations optionally aerich upgrade to apply any new migrations

pawelkoston commented 10 months ago

Thank you for help, that worked.