mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-06 01:37:45 +08:00
This change solves the basename collision bug by using UNIQUE(file_path) on the unified asset_references table. Key changes: Database: - Migration 0005 merges asset_cache_states and asset_infos into asset_references - AssetReference now contains: cache state fields (file_path, mtime_ns, needs_verify, is_missing, enrichment_level) plus info fields (name, owner_id, preview_id, etc.) - AssetReferenceMeta replaces AssetInfoMeta - AssetReferenceTag replaces AssetInfoTag - UNIQUE constraint on file_path prevents duplicate entries for same file Code: - New unified query module: asset_reference.py (replaces asset_info.py, cache_state.py) - Updated scanner, seeder, and services to use AssetReference - Updated API routes to use reference_id instead of asset_info_id Tests: - All 175 unit tests updated and passing - Integration tests require server environment (not run here) Amp-Thread-ID: https://ampcode.com/threads/T-019c4fe8-9dcb-75ce-bea8-ea786343a581 Co-authored-by: Amp <amp@ampcode.com>
33 lines
846 B
Python
33 lines
846 B
Python
"""
|
|
Drop unique constraint on assets_info (asset_id, owner_id, name)
|
|
|
|
Allow multiple files with the same name to reference the same asset.
|
|
|
|
Revision ID: 0004_drop_asset_info_unique
|
|
Revises: 0003_add_enrichment_level
|
|
Create Date: 2025-02-11 00:00:00
|
|
"""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "0004_drop_asset_info_unique"
|
|
down_revision = "0003_add_enrichment_level"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
with op.batch_alter_table("assets_info") as batch_op:
|
|
batch_op.drop_constraint(
|
|
"uq_assets_info_asset_owner_name", type_="unique"
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
with op.batch_alter_table("assets_info") as batch_op:
|
|
batch_op.create_unique_constraint(
|
|
"uq_assets_info_asset_owner_name",
|
|
["asset_id", "owner_id", "name"],
|
|
)
|