From c707f7ecb2eb2b1b383c7abda439ff89c87000ed Mon Sep 17 00:00:00 2001 From: long2ice Date: Sat, 28 Nov 2020 14:31:41 +0800 Subject: [PATCH] bug fix --- aerich/__init__.py | 2 +- aerich/cli.py | 2 -- aerich/migrate.py | 2 +- pyproject.toml | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/aerich/__init__.py b/aerich/__init__.py index 6a9beea..3d26edf 100644 --- a/aerich/__init__.py +++ b/aerich/__init__.py @@ -1 +1 @@ -__version__ = "0.4.0" +__version__ = "0.4.1" diff --git a/aerich/cli.py b/aerich/cli.py index 10d3b08..0a4ffbb 100644 --- a/aerich/cli.py +++ b/aerich/cli.py @@ -33,7 +33,6 @@ def wrapper(*args, **kwargs): loop = asyncio.get_event_loop() ctx = args[0] loop.run_until_complete(f(*args, **kwargs)) - loop.run_until_complete(Tortoise.close_connections()) app = ctx.obj.get("app") if app: Migrate.remove_old_model_file(app, ctx.obj["location"]) @@ -113,7 +112,6 @@ async def upgrade(ctx: Context): file_path = os.path.join(Migrate.migrate_location, version_file) content = get_version_content_from_file(file_path) upgrade_query_list = content.get("upgrade") - print(upgrade_query_list) for upgrade_query in upgrade_query_list: await conn.execute_script(upgrade_query) await Aerich.create( diff --git a/aerich/migrate.py b/aerich/migrate.py index 3a5abfe..d4768fd 100644 --- a/aerich/migrate.py +++ b/aerich/migrate.py @@ -94,6 +94,7 @@ async def init_with_old_models(cls, config: dict, app: str, location: str): await Tortoise.init(config=migrate_config) connection = get_app_connection(config, app) + cls.dialect = connection.schema_generator.DIALECT if cls.dialect == "mysql": from aerich.ddl.mysql import MysqlDDL @@ -106,7 +107,6 @@ async def init_with_old_models(cls, config: dict, app: str, location: str): from aerich.ddl.postgres import PostgresDDL cls.ddl = PostgresDDL(connection) - cls.dialect = cls.ddl.DIALECT await cls._get_db_version(connection) @classmethod diff --git a/pyproject.toml b/pyproject.toml index 655f7f4..18c5244 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "aerich" -version = "0.4.0" +version = "0.4.1" description = "A database migrations tool for Tortoise ORM." authors = ["long2ice "] license = "Apache-2.0"