Fix migration 0004 aborting when ix_tags_tag_type is missing - #15252
Fix migration 0004 aborting when ix_tags_tag_type is missing#15252Constantine1916 wants to merge 1 commit into
Conversation
Databases created by older builds can be at revision 0003 without ix_tags_tag_type on the tags table. The unconditional drop_index in 0004_drop_tag_type then aborts the whole upgrade with "ValueError: No such index" and ComfyUI fails to start. Inspect the existing indexes and only drop the index when present; the tag_type column is still dropped either way.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (4)**/*📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
**⚙️ CodeRabbit configuration file
Files:
alembic_db/**⚙️ CodeRabbit configuration file
Files:
🧠 Learnings (1)📚 Learning: 2026-02-21T14:01:41.482ZApplied to files:
🔇 Additional comments (2)
📝 WalkthroughWalkthroughThe revision 0004 migration now checks whether 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes #15022
Summary
0004_drop_tag_typeunconditionally callsdrop_index("ix_tags_tag_type"). Databases in the wild can be at revision 0003 without that index (tables created by older builds), so the whole upgrade aborts withValueError: No such index: 'ix_tags_tag_type'and ComfyUI fails to start.tagsand only drop the index when it is present. Thetag_typecolumn is still dropped either way, so the resulting schema is identical in both cases.Testing
ValueError, now succeeds andtag_typeis gone..venv/bin/python -m pytest tests-unit/app_test/test_migrations.py -q(5 passed).venv/bin/python -m ruff check .