Package ai.mindconnect.adminui.service
Class MigrationService
java.lang.Object
ai.mindconnect.adminui.service.MigrationService
Computes and applies "migrations" — pending imports of bundled initial data
(classpath
initial-data/**) against what is currently stored.
Where ai.mindconnect.adminui.InitialDataLoader silently imports new
records at startup and skips differing ones, this service surfaces every
pending change (new and changed) so an admin can review the diff in
the Migrations tab and apply or ignore each one individually.
A pending migration is identified by a stable MigrationService.PendingMigration.id()
derived from its entity type and name, so the UI can round-trip an "apply"
request without holding server-side state between calls.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSupported entity types — also used as the id prefix and UI grouping label.static final recordOne top-level field that differs.static final recordOne reviewable change.static enumWhether a stored record is absent (NEW) or present-but-different (CHANGED). -
Constructor Summary
ConstructorsConstructorDescriptionMigrationService(ai.mindconnect.llm.port.out.LlmConfigRepository llmConfigRepository, ai.mindconnect.agent.port.out.AgentDefinitionRepository agentDefinitionRepository, ai.mindconnect.workflow.persistence.port.WorkflowDataRepository workflowDataRepository, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptionbooleanApplies the pending migration with the givenMigrationService.PendingMigration.id()by saving the bundled (classpath) version over the stored one.intapplyAll()Applies every currently-pending migration.pending()All pending migrations across every supported entity type.
-
Constructor Details
-
MigrationService
public MigrationService(ai.mindconnect.llm.port.out.LlmConfigRepository llmConfigRepository, ai.mindconnect.agent.port.out.AgentDefinitionRepository agentDefinitionRepository, ai.mindconnect.workflow.persistence.port.WorkflowDataRepository workflowDataRepository, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
pending
All pending migrations across every supported entity type. -
apply
Applies the pending migration with the givenMigrationService.PendingMigration.id()by saving the bundled (classpath) version over the stored one.- Returns:
- true if a matching pending migration was found and applied
-
applyAll
public int applyAll()Applies every currently-pending migration. Returns the number applied.
-