Fix pyproject.toml not existing error. (#217)

This commit is contained in:
long2ice 2021-12-12 22:11:51 +08:00
parent 63e8d06157
commit c60c1610f0
4 changed files with 12 additions and 6 deletions

View File

@ -2,6 +2,10 @@
## 0.6
### 0.6.1
- Fix `pyproject.toml` not existing error. (#217)
### 0.6.0
- Change default config file from `aerich.ini` to `pyproject.toml`. (#197)

View File

@ -193,10 +193,12 @@ async def init(ctx: Context, tortoise_orm, location, src_folder):
# check that we can find the configuration, if not we can fail before the config file gets created
add_src_path(src_folder)
get_tortoise_config(ctx, tortoise_orm)
with open(config_file, "r") as f:
content = f.read()
doc = tomlkit.parse(content)
if Path(config_file).exists():
with open(config_file, "r") as f:
content = f.read()
doc = tomlkit.parse(content)
else:
doc = tomlkit.parse("[tool.aerich]")
table = tomlkit.table()
table["tortoise_orm"] = tortoise_orm
table["location"] = location

View File

@ -1 +1 @@
__version__ = "0.6.0"
__version__ = "0.6.1"

View File

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