update version

This commit is contained in:
long2ice 2021-09-27 19:55:38 +08:00
parent 24c1f4cb7d
commit b1521c4cc7
5 changed files with 18 additions and 14 deletions

View File

@ -1,8 +1,8 @@
# ChangeLog # ChangeLog
## 0.5 ## 0.6
### 0.5.9 ### 0.6.0
- Change default config file from `aerich.ini` to `pyproject.toml`. (#197) - Change default config file from `aerich.ini` to `pyproject.toml`. (#197)
@ -10,6 +10,8 @@
1. Run `aerich init -t config.TORTOISE_ORM`. 1. Run `aerich init -t config.TORTOISE_ORM`.
2. Remove `aerich.ini`. 2. Remove `aerich.ini`.
## 0.5
### 0.5.8 ### 0.5.8
- Support `indexes` change. (#193) - Support `indexes` change. (#193)

View File

@ -15,7 +15,7 @@ it\'s own migration solution.
Just install from pypi: Just install from pypi:
```shell ```shell
> pip install aerich pip install aerich
``` ```
## Quick Start ## Quick Start
@ -27,11 +27,10 @@ Usage: aerich [OPTIONS] COMMAND [ARGS]...
Options: Options:
-V, --version Show the version and exit. -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. --app TEXT Tortoise-ORM app name.
-n, --name TEXT Name of section in .ini file to use for aerich config. -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. -h, --help Show this message and exit.
Commands: Commands:
@ -70,10 +69,9 @@ Usage: aerich init [OPTIONS]
Init config file and generate root migrate location. Init config file and generate root migrate location.
OOptions: Options:
-t, --tortoise-orm TEXT Tortoise-ORM config module dict variable, like -t, --tortoise-orm TEXT Tortoise-ORM config module dict variable, like
settings.TORTOISE_ORM. [required] settings.TORTOISE_ORM. [required]
--location TEXT Migrate store location. [default: ./migrations] --location TEXT Migrate store location. [default: ./migrations]
-s, --src_folder TEXT Folder of the source, relative to the project root. -s, --src_folder TEXT Folder of the source, relative to the project root.
-h, --help Show this message and exit. -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 > aerich init -t tests.backends.mysql.TORTOISE_ORM
Success create migrate location ./migrations Success create migrate location ./migrations
Success generate config file aerich.ini Success write config to pyproject.toml
``` ```
### Init db ### Init db

View File

@ -7,6 +7,7 @@ from typing import List
import click import click
import tomlkit import tomlkit
from click import Context, UsageError from click import Context, UsageError
from tomlkit.exceptions import NonExistentKey
from tortoise import Tortoise from tortoise import Tortoise
from aerich.exceptions import DowngradeError from aerich.exceptions import DowngradeError
@ -67,9 +68,12 @@ async def cli(ctx: Context, config, app, name):
with open(config, "r") as f: with open(config, "r") as f:
content = f.read() content = f.read()
doc = tomlkit.parse(content) doc = tomlkit.parse(content)
location = doc[name]["location"] try:
tortoise_orm = doc[name]["tortoise_orm"] location = doc[name]["location"]
src_folder = doc[name].get("src_folder", CONFIG_DEFAULT_VALUES["src_folder"]) 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) add_src_path(src_folder)
tortoise_config = get_tortoise_config(ctx, tortoise_orm) tortoise_config = get_tortoise_config(ctx, tortoise_orm)
app = app or list(tortoise_config.get("apps").keys())[0] app = app or list(tortoise_config.get("apps").keys())[0]

View File

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

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "aerich" name = "aerich"
version = "0.5.9" version = "0.6.0"
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"