Skip to content

Commit

Permalink
🐛 fix(alembic): startup prompt ugly abort
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgramRipper committed May 22, 2024
1 parent 1241daf commit 4be2fb6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nonebot_plugin_orm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,12 @@ async def init_orm() -> None:
cmd_opts.cmd = (migrate.check, [], [])
try:
await greenlet_spawn(migrate.check, alembic_config)
except click.UsageError:
if not click.confirm("目标数据库未更新到最新迁移, 是否更新?"):
raise
except click.UsageError as e:
try:
click.confirm("目标数据库未更新到最新迁移, 是否更新?", abort=True)
except click.Abort:
raise e

cmd_opts.cmd = (migrate.upgrade, [], [])
await greenlet_spawn(migrate.upgrade, alembic_config)
else:
Expand Down

0 comments on commit 4be2fb6

Please sign in to comment.