Releases: nonebot/plugin-orm
Releases · nonebot/plugin-orm
🔖 Release 0.3.0
🔖 Release 0.2.4
🔖 Release 0.2.3
🔖 Release 0.2.2
🔖 Release 0.2.1
What's Changed
Full Changelog: v0.2.0...v0.2.1
🔖 Release 0.2.0
Notable Changes
- 🐛 fix(alembic): env.py open multi transcations
此修复改动了模板中的 env.py. 对于初始化脚本目录后使用的用户, 需要对 env.py 应用如下更改:
单数据库模板 (generic)
--- a/migrations/env.py
+++ b/migrations/env.py
@@ -59,7 +59,7 @@ async def run_migrations_online() -> None:
这种情况下,我们需要为 context 创建一个连接。
"""
- async with engine.begin() as connection:
+ async with engine.connect() as connection:
await connection.run_sync(do_run_migrations)多数据库模板 (multidb)
--- a/migrations/env.py
+++ b/migrations/env.py
@@ -52,6 +52,7 @@ def run_migrations_offline() -> None:
# 使用 --sql 选项的情况下,将每个引擎的迁移写入到单独的 .sql 文件中。
for name, engine in engines.items():
+ config.print_stdout(f"迁移数据库 {name or '<default>'} 中 ...")
file_ = f"{name}.sql"
with open(file_, "w") as buffer:
context.configure(
@@ -62,9 +63,7 @@ def run_migrations_offline() -> None:
dialect_opts={"paramstyle": "named"},
**plugin_config.alembic_context,
)
- with context.begin_transaction(), config.status(
- f"迁移数据库 {name or '<default>'} 中"
- ):
+ with context.begin_transaction():
context.run_migrations(name=name)
config.print_stdout(f"将输出写入到 {file_}")- 💥 refactor(alembic)!: AlembicConfig initialization and version locati…
此重构改动了读取插件内的迁移脚本目录的方式. 现在要求orm_version_location必须是一个常规包 (regular package) 而非命名空间包 (namespace package), 所以需要在插件内的迁移脚本目录中添加 __init__.py 文件:
--- a/a.tree
+++ b/b.tree
@@ -1,8 +1,9 @@
.
└── nonebot_plugin
├── config.py
├── __init__.py
└── migrations
├── 21e03401e435_.py
├── 595fd3d5f5b4_.py
- └── e04c11aa30b7_.py
+ ├── e04c11aa30b7_.py
+ └── __init__.pyWhat's Changed
Full Changelog: v0.1.2...v0.2.0
🔖 Release 0.1.2
🔖 Release 0.1.1
🔖 Release 0.1.0
What's Changed
- ⬆️ auto update by pre-commit hooks by @pre-commit-ci in #2
- 🔖 Release 0.1.0 by @ProgramRipper in #1
New Contributors
- @pre-commit-ci made their first contribution in #2
- @ProgramRipper made their first contribution in #1
Full Changelog: https://github.com/nonebot/plugin-orm/commits/v0.1.0