diff --git a/CHANGELOG.md b/CHANGELOG.md index c8e2382..7732057 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # ChangeLog -## 0.5 +## 0.6 -### 0.5.9 +### 0.6.0 - Change default config file from `aerich.ini` to `pyproject.toml`. (#197) @@ -10,6 +10,8 @@ 1. Run `aerich init -t config.TORTOISE_ORM`. 2. Remove `aerich.ini`. +## 0.5 + ### 0.5.8 - Support `indexes` change. (#193) diff --git a/README.md b/README.md index 94074dc..11b10d5 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ it\'s own migration solution. Just install from pypi: ```shell -> pip install aerich +pip install aerich ``` ## Quick Start @@ -27,11 +27,10 @@ Usage: aerich [OPTIONS] COMMAND [ARGS]... Options: -V, --version Show the version and exit. - -c, --config TEXT Config file. [default: aerich.ini] + -c, --config TEXT Config file. [default: pyproject.toml] --app TEXT Tortoise-ORM app name. -n, --name TEXT Name of section in .ini file to use for aerich config. - [default: aerich] - + [default: tool.aerich] -h, --help Show this message and exit. Commands: @@ -70,10 +69,9 @@ Usage: aerich init [OPTIONS] Init config file and generate root migrate location. -OOptions: +Options: -t, --tortoise-orm TEXT Tortoise-ORM config module dict variable, like settings.TORTOISE_ORM. [required] - --location TEXT Migrate store location. [default: ./migrations] -s, --src_folder TEXT Folder of the source, relative to the project root. -h, --help Show this message and exit. @@ -85,7 +83,7 @@ Initialize the config file and migrations location: > aerich init -t tests.backends.mysql.TORTOISE_ORM Success create migrate location ./migrations -Success generate config file aerich.ini +Success write config to pyproject.toml ``` ### Init db diff --git a/aerich/cli.py b/aerich/cli.py index c93b9e4..2e4a2f4 100644 --- a/aerich/cli.py +++ b/aerich/cli.py @@ -7,6 +7,7 @@ from typing import List import click import tomlkit from click import Context, UsageError +from tomlkit.exceptions import NonExistentKey from tortoise import Tortoise from aerich.exceptions import DowngradeError @@ -67,9 +68,12 @@ async def cli(ctx: Context, config, app, name): with open(config, "r") as f: content = f.read() doc = tomlkit.parse(content) - location = doc[name]["location"] - tortoise_orm = doc[name]["tortoise_orm"] - src_folder = doc[name].get("src_folder", CONFIG_DEFAULT_VALUES["src_folder"]) + try: + location = doc[name]["location"] + tortoise_orm = doc[name]["tortoise_orm"] + src_folder = doc[name].get("src_folder", CONFIG_DEFAULT_VALUES["src_folder"]) + except NonExistentKey: + raise UsageError("You need run aerich init again when upgrade to 0.6.0+") add_src_path(src_folder) tortoise_config = get_tortoise_config(ctx, tortoise_orm) app = app or list(tortoise_config.get("apps").keys())[0] diff --git a/aerich/version.py b/aerich/version.py index 40e294f..906d362 100644 --- a/aerich/version.py +++ b/aerich/version.py @@ -1 +1 @@ -__version__ = "0.5.9" +__version__ = "0.6.0" diff --git a/pyproject.toml b/pyproject.toml index c8743cf..414b873 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "aerich" -version = "0.5.9" +version = "0.6.0" description = "A database migrations tool for Tortoise ORM." authors = ["long2ice "] license = "Apache-2.0"