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

There are errors in the upgrade, but no transaction rollback #287

Open kulta-jim opened 1 year ago

kulta-jim commented 1 year ago

python===3.10.6 aerich===0.7.1 tortoise-orm[aiomysql]==0.19.3

Aerich has no transaction rollback. I got a duplicate entry error after the first upgrade, and then I manually deleted the duplicate. However, during the second upgrade, it was found that the tables of some databases had been modified in the first upgrade.

koffie commented 11 months ago

Did you run the upgrade with the --in-transaction option?

$ aerich upgrade --help
Usage: aerich upgrade [OPTIONS]

  Upgrade to specified version.

Options:
  -i, --in-transaction BOOLEAN  Make migrations in transaction or not. Can be
                                helpful for large migrations or creating
                                concurrent indexes.
  -h, --help                    Show this message and exit.