migration fixes
This commit is contained in:
parent
819ede9aa1
commit
c6a6f26275
|
@ -1090,7 +1090,13 @@ public class DatasetMigrationService {
|
|||
UUID existingTagId = savedTagIdsByName.getOrDefault(new TagKey(dataset, tag), null);
|
||||
if (existingTagId != null) return existingTagId;
|
||||
TagEntity tagEntity = new TagEntity();
|
||||
if (!existingTagIds.contains(UUID.fromString(tag.getId()))) tagEntity.setId(UUID.fromString(tag.getId()));
|
||||
UUID tagId;
|
||||
try{
|
||||
tagId = UUID.fromString(tag.getId());
|
||||
} catch (Exception e){
|
||||
tagId = UUID.randomUUID();
|
||||
}
|
||||
if (!existingTagIds.contains(tagId)) tagEntity.setId(tagId);
|
||||
else tagEntity.setId(UUID.randomUUID());
|
||||
tagEntity.setLabel(tag.getName());
|
||||
tagEntity.setCreatedAt(Instant.now());
|
||||
|
@ -1098,6 +1104,7 @@ public class DatasetMigrationService {
|
|||
if (dataset.getCreator() != null) tagEntity.setCreatedById(dataset.getCreator().getId());
|
||||
tagEntity.setIsActive(IsActive.Active);
|
||||
savedTagIdsByName.put(new TagKey(dataset, tag), tagEntity.getId());
|
||||
existingTagIds.add(tagEntity.getId());
|
||||
this.entityManager.persist(tagEntity);
|
||||
this.entityManager.flush();
|
||||
|
||||
|
|
Loading…
Reference in New Issue