Skip to content

Commit

Permalink
Fix no module found error. (#188) (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
long2ice committed Aug 16, 2021
1 parent 3595257 commit af63221
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 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.5

### 0.5.7

- Fix no module found error. (#188) (#189)

### 0.5.6

- Add `Command` class. (#148) (#141) (#123) (#106)
Expand Down
6 changes: 0 additions & 6 deletions aerich/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
__version__ = "0.5.6"

import os
from pathlib import Path
from typing import List
Expand All @@ -14,7 +12,6 @@
from aerich.migrate import Migrate
from aerich.models import Aerich
from aerich.utils import (
add_src_path,
get_app_connection,
get_app_connection_name,
get_models_describe,
Expand All @@ -29,14 +26,11 @@ def __init__(
tortoise_config: dict,
app: str = "models",
location: str = "./migrations",
src_folder: str = ".",
):
self.tortoise_config = tortoise_config
self.app = app
self.location = location
self.src_folder = src_folder
Migrate.app = app
add_src_path(src_folder)

async def init(self):
await Migrate.init(self.tortoise_config, self.app, self.location)
Expand Down
8 changes: 4 additions & 4 deletions aerich/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
from aerich.exceptions import DowngradeError
from aerich.utils import add_src_path, get_tortoise_config

from . import Command, __version__
from . import Command
from .enums import Color
from .version import __version__

parser = ConfigParser()

Expand Down Expand Up @@ -70,11 +71,10 @@ async def cli(ctx: Context, config, app, name):
location = parser[name]["location"]
tortoise_orm = parser[name]["tortoise_orm"]
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)
app = app or list(tortoise_config.get("apps").keys())[0]
command = Command(
tortoise_config=tortoise_config, app=app, location=location, src_folder=src_folder
)
command = Command(tortoise_config=tortoise_config, app=app, location=location)
ctx.obj["command"] = command
if invoked_subcommand != "init-db":
if not Path(location, app).exists():
Expand Down
1 change: 1 addition & 0 deletions aerich/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.5.7"
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.5.6"
version = "0.5.7"
description = "A database migrations tool for Tortoise ORM."
authors = ["long2ice <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit af63221

Please sign in to comment.