Skip to content

Commit

Permalink
Fix pyproject.toml not existing error. (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
long2ice committed Dec 12, 2021
1 parent 63e8d06 commit c60c161
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions aerich/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion aerich/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.6.0"
__version__ = "0.6.1"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit c60c161

Please sign in to comment.