diff --git a/src/Infrastructure/OpcUa/MetadataLoaderService.cs b/src/Infrastructure/OpcUa/MetadataLoaderService.cs index 26642ad..7ede22a 100644 --- a/src/Infrastructure/OpcUa/MetadataLoaderService.cs +++ b/src/Infrastructure/OpcUa/MetadataLoaderService.cs @@ -37,6 +37,13 @@ public class MetadataLoaderService : IMetadataLoaderService var baseTagSet = baseTags.ToHashSet(StringComparer.OrdinalIgnoreCase); if (baseTagSet.Count == 0) return 0; + // ── Step 0: realtime_table에 없는 orphan base_tag 삭제 ───────────── + await _ctx.Database.ExecuteSqlRawAsync(@" + DELETE FROM tag_metadata + WHERE base_tag NOT IN ( + SELECT DISTINCT LOWER(split_part(tagname, '.', 1)) FROM realtime_table + )"); + // ── Step 1: node_map_master에서 실제 node_id 조회 ────────────────── // hostname을 직접 조성하지 않고 DB에 저장된 원본 node_id를 사용 var masterNodes = await _ctx.NodeMapMasters diff --git a/src/Web/wwwroot/index.html b/src/Web/wwwroot/index.html index 3661765..560b015 100644 --- a/src/Web/wwwroot/index.html +++ b/src/Web/wwwroot/index.html @@ -686,7 +686,7 @@ 태그의 desc, area, state descriptor 정보를 OPC UA에서 조회하여 저장합니다.