ALTER TABLE qipai_media_assets
  DROP INDEX uq_qipai_media_tenant_checksum,
  ADD COLUMN scope_store_id BIGINT UNSIGNED
    GENERATED ALWAYS AS (IFNULL(store_id, 0)) STORED AFTER store_id,
  ADD UNIQUE KEY uq_qipai_media_scope_checksum
    (tenant_id, scope_store_id, checksum_sha256);

INSERT IGNORE INTO qipai_schema_migrations (version, name)
VALUES ('2026081002', 'm08d_content_asset_scope');
