Fix first version error

This commit is contained in:
long2ice 2020-10-10 15:07:09 +08:00
parent 09b89ed7d0
commit d0ce545ff5
4 changed files with 10 additions and 5 deletions

View File

@ -2,6 +2,10 @@
## 0.3 ## 0.3
### 0.3.1
- Fix first version error.
### 0.3.0 ### 0.3.0
- Refactoring migrate logic, and this version is not compatible with previous version. - Refactoring migrate logic, and this version is not compatible with previous version.

View File

@ -1 +1 @@
__version__ = "0.3.0" __version__ = "0.3.1"

View File

@ -67,9 +67,10 @@ class Migrate:
async def init_with_old_models(cls, config: dict, app: str, location: str): async def init_with_old_models(cls, config: dict, app: str, location: str):
await Tortoise.init(config=config) await Tortoise.init(config=config)
last_version = await cls.get_last_version() last_version = await cls.get_last_version()
content = last_version.content if last_version:
with open(cls.get_old_model_file(app, location), "w") as f: content = last_version.content
f.write(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) migrate_config = cls._get_migrate_config(config, app, location)
cls.app = app cls.app = app

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "aerich" name = "aerich"
version = "0.3.0" version = "0.3.1"
description = "A database migrations tool for Tortoise ORM." description = "A database migrations tool for Tortoise ORM."
authors = ["long2ice <long2ice@gmail.com>"] authors = ["long2ice <long2ice@gmail.com>"]
license = "Apache-2.0" license = "Apache-2.0"