Skip to content

Commit 12bc809

Browse files
committed
🐛 fix(alembic): default version_path and branch_label of revision
1 parent 8468906 commit 12bc809

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nonebot_plugin_orm/migrate.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,16 +447,20 @@ def revision(
447447
reversed(list(get_parent_plugins(plugin))),
448448
)
449449
)
450-
else:
450+
elif not head:
451451
version_path = config._temp_dir
452452

453+
if isinstance(version_path, Path):
454+
version_path = str(version_path)
455+
453456
script = ScriptDirectory.from_config(config)
454457

455458
if not head:
456459
scripts = script.get_revisions(script.get_heads())
457460
if branch_label:
458461
if any(branch_label in sc.branch_labels for sc in scripts):
459462
head = f"{branch_label}@head"
463+
branch_label = None
460464
else:
461465
head = "base"
462466
elif len(scripts) <= 1:
@@ -477,7 +481,7 @@ def revision(
477481
head=head,
478482
splice=splice,
479483
branch_label=branch_label,
480-
version_path=str(version_path),
484+
version_path=version_path,
481485
rev_id=rev_id,
482486
depends_on=depends_on,
483487
),

0 commit comments

Comments
 (0)