parent
359525716c
commit
af63221875
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
## 0.5
|
## 0.5
|
||||||
|
|
||||||
|
### 0.5.7
|
||||||
|
|
||||||
|
- Fix no module found error. (#188) (#189)
|
||||||
|
|
||||||
### 0.5.6
|
### 0.5.6
|
||||||
|
|
||||||
- Add `Command` class. (#148) (#141) (#123) (#106)
|
- Add `Command` class. (#148) (#141) (#123) (#106)
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
__version__ = "0.5.6"
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
@ -14,7 +12,6 @@ from aerich.inspectdb import InspectDb
|
|||||||
from aerich.migrate import Migrate
|
from aerich.migrate import Migrate
|
||||||
from aerich.models import Aerich
|
from aerich.models import Aerich
|
||||||
from aerich.utils import (
|
from aerich.utils import (
|
||||||
add_src_path,
|
|
||||||
get_app_connection,
|
get_app_connection,
|
||||||
get_app_connection_name,
|
get_app_connection_name,
|
||||||
get_models_describe,
|
get_models_describe,
|
||||||
@ -29,14 +26,11 @@ class Command:
|
|||||||
tortoise_config: dict,
|
tortoise_config: dict,
|
||||||
app: str = "models",
|
app: str = "models",
|
||||||
location: str = "./migrations",
|
location: str = "./migrations",
|
||||||
src_folder: str = ".",
|
|
||||||
):
|
):
|
||||||
self.tortoise_config = tortoise_config
|
self.tortoise_config = tortoise_config
|
||||||
self.app = app
|
self.app = app
|
||||||
self.location = location
|
self.location = location
|
||||||
self.src_folder = src_folder
|
|
||||||
Migrate.app = app
|
Migrate.app = app
|
||||||
add_src_path(src_folder)
|
|
||||||
|
|
||||||
async def init(self):
|
async def init(self):
|
||||||
await Migrate.init(self.tortoise_config, self.app, self.location)
|
await Migrate.init(self.tortoise_config, self.app, self.location)
|
||||||
|
@ -12,8 +12,9 @@ from tortoise import Tortoise
|
|||||||
from aerich.exceptions import DowngradeError
|
from aerich.exceptions import DowngradeError
|
||||||
from aerich.utils import add_src_path, get_tortoise_config
|
from aerich.utils import add_src_path, get_tortoise_config
|
||||||
|
|
||||||
from . import Command, __version__
|
from . import Command
|
||||||
from .enums import Color
|
from .enums import Color
|
||||||
|
from .version import __version__
|
||||||
|
|
||||||
parser = ConfigParser()
|
parser = ConfigParser()
|
||||||
|
|
||||||
@ -70,11 +71,10 @@ async def cli(ctx: Context, config, app, name):
|
|||||||
location = parser[name]["location"]
|
location = parser[name]["location"]
|
||||||
tortoise_orm = parser[name]["tortoise_orm"]
|
tortoise_orm = parser[name]["tortoise_orm"]
|
||||||
src_folder = parser[name].get("src_folder", CONFIG_DEFAULT_VALUES["src_folder"])
|
src_folder = parser[name].get("src_folder", CONFIG_DEFAULT_VALUES["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]
|
||||||
command = Command(
|
command = Command(tortoise_config=tortoise_config, app=app, location=location)
|
||||||
tortoise_config=tortoise_config, app=app, location=location, src_folder=src_folder
|
|
||||||
)
|
|
||||||
ctx.obj["command"] = command
|
ctx.obj["command"] = command
|
||||||
if invoked_subcommand != "init-db":
|
if invoked_subcommand != "init-db":
|
||||||
if not Path(location, app).exists():
|
if not Path(location, app).exists():
|
||||||
|
1
aerich/version.py
Normal file
1
aerich/version.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
__version__ = "0.5.7"
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "aerich"
|
name = "aerich"
|
||||||
version = "0.5.6"
|
version = "0.5.7"
|
||||||
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"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user