ICkModelUpgradeService
Namespace: Meshmakers.Octo.Runtime.Contracts.CkModelMigrations
Service for automatically checking and executing CK model migrations when a new version is loaded
public interface ICkModelUpgradeService
Methods
UpgradeModelsAsync(String, IEnumerable<CkModelIdVersionRange>, CkMigrationOptions, IReadOnlyDictionary<String, String>, CancellationToken)
Checks if a tenant needs migration for any of its loaded CK models and executes them
Task<CkModelUpgradeResult> UpgradeModelsAsync(string tenantId, IEnumerable<CkModelIdVersionRange> newModelIds, CkMigrationOptions options, IReadOnlyDictionary<string, string> previouslyInstalledVersions, CancellationToken cancellationToken)
Parameters
tenantId String
Target tenant identifier
newModelIds IEnumerable<CkModelIdVersionRange>
The new CK model versions being loaded (can be version ranges)
options CkMigrationOptions
Migration execution options
previouslyInstalledVersions IReadOnlyDictionary<String, String>
Optional dictionary of previously installed versions (model name -> version string).
This is used as a fallback when no MigrationHistory exists for a model.
Should be obtained by calling GetSchemaVersionsAsync BEFORE importing the new CK model.
cancellationToken CancellationToken
Cancellation token
Returns
Task<CkModelUpgradeResult>
Result of the upgrade check and migration execution
CheckUpgradeNeededAsync(String, String, String, CancellationToken)
Checks if a tenant needs migration for a specific CK model
Task<CkModelUpgradeInfo> CheckUpgradeNeededAsync(string tenantId, string ckModelName, string targetVersion, CancellationToken cancellationToken)
Parameters
tenantId String
Target tenant identifier
ckModelName String
Name of the CK model to check
targetVersion String
Target version being loaded
cancellationToken CancellationToken
Cancellation token
Returns
Task<CkModelUpgradeInfo>
Information about whether migration is needed
GetInstalledVersionsAsync(String, CancellationToken)
Gets the currently tracked CK model versions for a tenant
Task<IReadOnlyDictionary<string, string>> GetInstalledVersionsAsync(string tenantId, CancellationToken cancellationToken)
Parameters
tenantId String
Tenant identifier
cancellationToken CancellationToken
Cancellation token
Returns
Task<IReadOnlyDictionary<String, String>>
Dictionary of model names to their installed versions
RecordInstalledVersionAsync(String, CkModelId, CancellationToken)
Records that a CK model version has been installed for a tenant (without migration)
Task RecordInstalledVersionAsync(string tenantId, CkModelId modelId, CancellationToken cancellationToken)
Parameters
tenantId String
Target tenant identifier
modelId CkModelId
The exact CK model version that was installed
cancellationToken CancellationToken
Cancellation token