diff --git a/CHANGELOG.md b/CHANGELOG.md index 4535835..8f85aea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 0.3 +### 0.3.1 + +- Fix first version error. + ### 0.3.0 - Refactoring migrate logic, and this version is not compatible with previous version. diff --git a/aerich/__init__.py b/aerich/__init__.py index 493f741..260c070 100644 --- a/aerich/__init__.py +++ b/aerich/__init__.py @@ -1 +1 @@ -__version__ = "0.3.0" +__version__ = "0.3.1" diff --git a/aerich/migrate.py b/aerich/migrate.py index a35cd26..3aeca38 100644 --- a/aerich/migrate.py +++ b/aerich/migrate.py @@ -67,9 +67,10 @@ class Migrate: async def init_with_old_models(cls, config: dict, app: str, location: str): await Tortoise.init(config=config) last_version = await cls.get_last_version() - content = last_version.content - with open(cls.get_old_model_file(app, location), "w") as f: - f.write(content) + if last_version: + content = last_version.content + with open(cls.get_old_model_file(app, location), "w") as f: + f.write(content) migrate_config = cls._get_migrate_config(config, app, location) cls.app = app diff --git a/pyproject.toml b/pyproject.toml index 6e19077..4695c61 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "aerich" -version = "0.3.0" +version = "0.3.1" description = "A database migrations tool for Tortoise ORM." authors = ["long2ice "] license = "Apache-2.0"