tortoise / aerich

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

Multiple aerich commands fail to close Tortoise connections #120

Closed AulonSal closed 3 years ago

AulonSal commented 3 years ago

Problem: Aerich commands that interact with the database do not close connections after finishing execution forcing you to manually kill the program.

What steps will reproduce the problem? Run init-db, downgrade, or any of the other commands that interact with the database with sqlite.

Expected Result All commands that interact with the database await Tortoise.close_connections() before returning, as recommended in https://tortoise-orm.readthedocs.io/en/latest/setup.html#the-importance-of-cleaning-up, using an async context manager with with clauses enclosing just the db code or a decorator wrapping the commands, it would be even simpler to just run until complete in the coro decorator.

AulonSal commented 3 years ago

Fixed in #121, 49897dc4fdad857334fd8eb98aef0f2dd1539a8f