Class MigrationService

java.lang.Object
ai.mindconnect.adminui.service.MigrationService

@Service public class MigrationService extends Object
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.

  • 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

      public boolean apply(String migrationId)
      Applies the pending migration with the given MigrationService.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.