fix: NonExistentKey when running aerich init without [tool] section in config file (#381)
* fix: NonExistentKey when running `aerich init` without `[tool]` section in config file * docs: update changelog
This commit is contained in:
@@ -190,7 +190,10 @@ async def init(ctx: Context, tortoise_orm, location, src_folder) -> None:
|
||||
table["tortoise_orm"] = tortoise_orm
|
||||
table["location"] = location
|
||||
table["src_folder"] = src_folder
|
||||
doc["tool"]["aerich"] = table
|
||||
try:
|
||||
doc["tool"]["aerich"] = table
|
||||
except KeyError:
|
||||
doc["tool"] = {"aerich": table}
|
||||
|
||||
config_path.write_text(tomlkit.dumps(doc))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user