mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-07-04 05:31:03 +08:00
Rename the in-root loader path response field from `file_path` to `loader_path` (matching compute_loader_path), and persist it on asset_references so the API reads it directly instead of re-resolving against every registered model-folder base per request. - add loader_path column (migration 0006) populated at scan/ingest from the already-computed loader path - response prefers the stored value, falling back to compute for rows written before the column existed
31 lines
892 B
Python
31 lines
892 B
Python
"""
|
|
Add loader_path column to asset_references.
|
|
|
|
Stores the in-root loader path (path relative to the storage root with the
|
|
top-level model category dropped) derived from file_path at scan/ingest time,
|
|
so the assets API can return it without re-resolving against every registered
|
|
model-folder base on every request.
|
|
|
|
Revision ID: 0006_add_loader_path
|
|
Revises: 0005_allow_case_sensitive_tags
|
|
Create Date: 2026-07-02
|
|
"""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "0006_add_loader_path"
|
|
down_revision = "0005_allow_case_sensitive_tags"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
with op.batch_alter_table("asset_references") as batch_op:
|
|
batch_op.add_column(sa.Column("loader_path", sa.Text(), nullable=True))
|
|
|
|
|
|
def downgrade() -> None:
|
|
with op.batch_alter_table("asset_references") as batch_op:
|
|
batch_op.drop_column("loader_path")
|