generated from yanyongyu/python-poetry-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
默认(public)下的 model
其他 schema(这里我设置了为 gv)
生成的迁移文件正常
数据库结构也正常
但是再次运行 bot(等效 nb orm check)会一直报错
目前临时解决办法是都放到 public 里面
日志
(flashbot) merlin@merlins-MacBook-Pro ~/HajimiBot dev ± nb orm revision -m "init"
使用 Python: /Users/merlin/HajimiBot/.venv/bin/python
02-04 17:48:37 [SUCCESS] nonebot | NoneBot is initializing...
02-04 17:48:37 [INFO] nonebot | Current Env: prod
02-04 17:48:38 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
02-04 17:48:38 [SUCCESS] nonebot | Succeeded to load plugin "group_verification" from "src.plugins.group_verification"
02-04 17:48:38 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler"
02-04 17:48:38 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_orm"
Generating /var/folders/1z/9d78dbgj09x6mn3yc180bffw0000gn/T/tmpb4162o0x/a08596fdd90d_init.py ... done
(flashbot) merlin@merlins-MacBook-Pro ~/HajimiBot dev ± nb run
使用 Python: /Users/merlin/HajimiBot/.venv/bin/python
02-04 17:49:15 [SUCCESS] nonebot | NoneBot is initializing...
02-04 17:49:15 [INFO] nonebot | Current Env: prod
02-04 17:49:16 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
02-04 17:49:16 [SUCCESS] nonebot | Succeeded to load plugin "group_verification" from "src.plugins.group_verification"
02-04 17:49:16 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler"
02-04 17:49:16 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_orm"
02-04 17:49:16 [SUCCESS] nonebot | Running NoneBot...
02-04 17:49:16 [SUCCESS] nonebot | Loaded adapters: OneBot V11
02-04 17:49:16 [INFO] uvicorn | Started server process [89632]
02-04 17:49:16 [INFO] uvicorn | Waiting for application startup.
目标数据库未更新到最新迁移, 是否更新? [y/N]: y
02-04 17:49:18 [WARNING] group_verification | 无法初始化B站会话: 登录凭证不存在或无效
02-04 17:49:18 [WARNING] group_verification | B站登录凭证不存在或无效,请发送"登录"命令进行登录
02-04 17:49:18 [INFO] nonebot_plugin_apscheduler | Scheduler Started
02-04 17:49:18 [INFO] uvicorn | Application startup complete.
02-04 17:49:18 [INFO] uvicorn | Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
02-04 17:49:19 [INFO] uvicorn | 127.0.0.1:57772 - "WebSocket /onebot/v11/ws" [accepted]
02-04 17:49:19 [INFO] nonebot | OneBot V11 | Bot 3648991638 connected
02-04 17:49:19 [INFO] websockets | connection open
^C02-04 17:49:22 [INFO] uvicorn | Shutting down
02-04 17:49:22 [WARNING] nonebot | OneBot V11 | WebSocket for Bot 3648991638 closed by peer
02-04 17:49:22 [INFO] websockets | connection closed
02-04 17:49:22 [INFO] uvicorn | Waiting for application shutdown.
02-04 17:49:22 [INFO] nonebot_plugin_apscheduler | Scheduler Shutdown
02-04 17:49:22 [INFO] uvicorn | Application shutdown complete.
02-04 17:49:22 [INFO] uvicorn | Finished server process [89632]
(flashbot) merlin@merlins-MacBook-Pro ~/HajimiBot dev ± nb run
使用 Python: /Users/merlin/HajimiBot/.venv/bin/python
02-04 17:49:29 [SUCCESS] nonebot | NoneBot is initializing...
02-04 17:49:29 [INFO] nonebot | Current Env: prod
02-04 17:49:29 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler"
02-04 17:49:30 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
02-04 17:49:30 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_orm"
02-04 17:49:30 [SUCCESS] nonebot | Succeeded to load plugin "group_verification" from "src.plugins.group_verification"
02-04 17:49:30 [SUCCESS] nonebot | Running NoneBot...
02-04 17:49:30 [SUCCESS] nonebot | Loaded adapters: OneBot V11
02-04 17:49:30 [INFO] uvicorn | Started server process [89844]
02-04 17:49:30 [INFO] uvicorn | Waiting for application startup.
02-04 17:49:30 [INFO] nonebot_plugin_apscheduler | Scheduler Started
02-04 17:49:30 [ERROR] uvicorn | Traceback (most recent call last):
File "/Users/merlin/HajimiBot/.venv/lib/python3.12/site-packages/starlette/routing.py", line 694, in lifespan
async with self.lifespan_context(app) as maybe_state:
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/merlin/.local/share/uv/python/cpython-3.12.12-macos-aarch64-none/lib/python3.12/contextlib.py", line 210, in __aenter__
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/merlin/HajimiBot/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 153, in merged_lifespan
async with original_context(app) as maybe_original_state:
^^^^^^^^^^^^^^^^^^^^^
File "/Users/merlin/.local/share/uv/python/cpython-3.12.12-macos-aarch64-none/lib/python3.12/contextlib.py", line 210, in __aenter__
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/merlin/HajimiBot/.venv/lib/python3.12/site-packages/nonebot/drivers/fastapi.py", line 154, in _lifespan_manager
await self._lifespan.startup()
File "/Users/merlin/HajimiBot/.venv/lib/python3.12/site-packages/nonebot/internal/driver/_lifespan.py", line 66, in startup
await self._run_lifespan_func(self._startup_funcs)
File "/Users/merlin/HajimiBot/.venv/lib/python3.12/site-packages/nonebot/internal/driver/_lifespan.py", line 55, in _run_lifespan_func
await cast(ASYNC_LIFESPAN_FUNC, func)()
File "/Users/merlin/HajimiBot/.venv/lib/python3.12/site-packages/nonebot_plugin_orm/__init__.py", line 92, in init_orm
await greenlet_spawn(migrate.check, alembic_config)
File "/Users/merlin/HajimiBot/.venv/lib/python3.12/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 203, in greenlet_spawn
result = context.switch(value)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/merlin/HajimiBot/.venv/lib/python3.12/site-packages/nonebot_plugin_orm/migrate.py", line 567, in check
raise AutogenerateDiffsDetected(
nonebot_plugin_orm.exception.AutogenerateDiffsDetected: 检测到新的升级操作:
[('add_table',
Table('gv_blacklist', MetaData(), Column('id', Uuid(), table=<gv_blacklist>, primary_key=True, nullable=False, default=CallableColumnDefault(<function uuid4 at 0x10a0c5e40>)), Column('bilibili_uid', BigInteger(), table=<gv_blacklist>), Column('qq_uid', BigInteger(), table=<gv_blacklist>), Column('created_at', DateTime(), table=<gv_blacklist>, nullable=False, server_default=DefaultClause(<sqlalchemy.sql.functions.now at 0x10a0aaa80; now>, for_update=False)), Column('updated_at', DateTime(), table=<gv_blacklist>, nullable=False, onupdate=ColumnElementColumnDefault(<sqlalchemy.sql.functions.now at 0x10a0aac90; now>), server_default=DefaultClause(<sqlalchemy.sql.functions.now at 0x10a0aac00; now>, for_update=False)), schema='gv')),
('add_index',
Index('idx_blacklist_bilibili_uid', Column('bilibili_uid', BigInteger(), table=<gv_blacklist>))),
('add_index',
Index('idx_blacklist_qq_uid', Column('qq_uid', BigInteger(), table=<gv_blacklist>))),
('add_table',
Table('gv_user', MetaData(), Column('id', Uuid(), table=<gv_user>, primary_key=True, nullable=False, default=CallableColumnDefault(<function uuid4 at 0x10a0c6520>)), Column('bilibili_uid', BigInteger(), table=<gv_user>, nullable=False), Column('qq_uid', BigInteger(), table=<gv_user>, nullable=False), Column('created_at', DateTime(), table=<gv_user>, nullable=False, server_default=DefaultClause(<sqlalchemy.sql.functions.now at 0x10a0aba40; now>, for_update=False)), Column('updated_at', DateTime(), table=<gv_user>, nullable=False, onupdate=ColumnElementColumnDefault(<sqlalchemy.sql.functions.now at 0x10a0abbf0; now>), server_default=DefaultClause(<sqlalchemy.sql.functions.now at 0x10a0abad0; now>, for_update=False)), schema='gv')),
('add_index',
Index('idx_user_bilibili_uid', Column('bilibili_uid', BigInteger(), table=<gv_user>, nullable=False))),
('add_index',
Index('idx_user_qq_uid', Column('qq_uid', BigInteger(), table=<gv_user>, nullable=False)))]
02-04 17:49:30 [ERROR] uvicorn | Application startup failed. Exiting.
(flashbot) merlin@merlins-MacBook-Pro ~/HajimiBot dev ± nb upgrade
使用 Python: /Users/merlin/HajimiBot/.venv/bin/python
Usage: nb [OPTIONS] COMMAND [ARGS]...
Try 'nb -h' for help.
Error: No such command 'upgrade'.
(flashbot) ✘ merlin@merlins-MacBook-Pro ~/HajimiBot dev ± nb orm upgrade
使用 Python: /Users/merlin/HajimiBot/.venv/bin/python
02-04 17:49:43 [SUCCESS] nonebot | NoneBot is initializing...
02-04 17:49:43 [INFO] nonebot | Current Env: prod
02-04 17:49:44 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
02-04 17:49:44 [SUCCESS] nonebot | Succeeded to load plugin "group_verification" from "src.plugins.group_verification"
02-04 17:49:44 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_orm"
02-04 17:49:44 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler"
(flashbot) merlin@merlins-MacBook-Pro ~/HajimiBot dev ± nb orm check
使用 Python: /Users/merlin/HajimiBot/.venv/bin/python
02-04 17:49:50 [SUCCESS] nonebot | NoneBot is initializing...
02-04 17:49:50 [INFO] nonebot | Current Env: prod
02-04 17:49:51 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
02-04 17:49:51 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_orm"
02-04 17:49:51 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler"
02-04 17:49:51 [SUCCESS] nonebot | Succeeded to load plugin "group_verification" from "src.plugins.group_verification"
Error: 检测到新的升级操作:
[('add_table',
Table('gv_blacklist', MetaData(), Column('id', Uuid(), table=<gv_blacklist>, primary_key=True, nullable=False, default=CallableColumnDefault(<function uuid4 at 0x10a2f1f80>)), Column('bilibili_uid', BigInteger(), table=<gv_blacklist>), Column('qq_uid', BigInteger(), table=<gv_blacklist>), Column('created_at', DateTime(), table=<gv_blacklist>, nullable=False, server_default=DefaultClause(<sqlalchemy.sql.functions.now at 0x10a2cb3e0; now>, for_update=False)), Column('updated_at', DateTime(), table=<gv_blacklist>, nullable=False, onupdate=ColumnElementColumnDefault(<sqlalchemy.sql.functions.now at 0x10a2cb5f0; now>), server_default=DefaultClause(<sqlalchemy.sql.functions.now at 0x10a2cb560; now>, for_update=False)), schema='gv')),
('add_index',
Index('idx_blacklist_bilibili_uid', Column('bilibili_uid', BigInteger(), table=<gv_blacklist>))),
('add_index',
Index('idx_blacklist_qq_uid', Column('qq_uid', BigInteger(), table=<gv_blacklist>))),
('add_table',
Table('gv_user', MetaData(), Column('id', Uuid(), table=<gv_user>, primary_key=True, nullable=False, default=CallableColumnDefault(<function uuid4 at 0x10a2f2660>)), Column('bilibili_uid', BigInteger(), table=<gv_user>, nullable=False), Column('qq_uid', BigInteger(), table=<gv_user>, nullable=False), Column('created_at', DateTime(), table=<gv_user>, nullable=False, server_default=DefaultClause(<sqlalchemy.sql.functions.now at 0x10ab5c350; now>, for_update=False)), Column('updated_at', DateTime(), table=<gv_user>, nullable=False, onupdate=ColumnElementColumnDefault(<sqlalchemy.sql.functions.now at 0x10ab5c500; now>), server_default=DefaultClause(<sqlalchemy.sql.functions.now at 0x10ab5c4a0; now>, for_update=False)), schema='gv')),
('add_index',
Index('idx_user_bilibili_uid', Column('bilibili_uid', BigInteger(), table=<gv_user>, nullable=False))),
('add_index',
Index('idx_user_qq_uid', Column('qq_uid', BigInteger(), table=<gv_user>, nullable=False)))]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels