check tortoise add aerich.models

This commit is contained in:
long2ice 2020-05-26 14:44:55 +08:00
parent c09c878eaf
commit 125389461f
2 changed files with 3 additions and 0 deletions

View File

@ -9,6 +9,7 @@ ChangeLog
- Fix default_connection when upgrade - Fix default_connection when upgrade
- Find default app instead of default. - Find default app instead of default.
- Diff MySQL ddl. - Diff MySQL ddl.
- Check tortoise config.
0.1.8 0.1.8
----- -----

View File

@ -57,6 +57,8 @@ async def cli(ctx: Context, config, app, name):
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]
if "aerich.models" not in tortoise_config.get("apps").get(app).get("models"):
raise UsageError("Check your tortoise config and add aerich.models to it.", ctx=ctx)
ctx.obj["config"] = tortoise_config ctx.obj["config"] = tortoise_config
ctx.obj["location"] = location ctx.obj["location"] = location
ctx.obj["app"] = app ctx.obj["app"] = app