Class ConfigSchemaVersion
Tracks configuration schema versions and provides migration support. Schema versions are stored alongside config files and checked on load to detect when migration is needed.
public sealed class ConfigSchemaVersion
- Inheritance
-
ConfigSchemaVersion
- Inherited Members
Constructors
ConfigSchemaVersion(string, ILogger?)
public ConfigSchemaVersion(string dataDir, ILogger? logger = null)
Parameters
dataDirstringDirectory where version metadata is stored (typically ~/.jdai/).
loggerILoggerOptional logger.
Fields
CurrentVersion
Current schema version for JD.AI configuration.
public const int CurrentVersion = 1
Field Value
Methods
ApplyMigrations()
Runs all pending migrations from stored version to current version. Returns the number of migrations applied.
public int ApplyMigrations()
Returns
GetStoredVersion()
Reads the stored schema version, or returns 0 if no version file exists (indicating a pre-versioning installation).
public int GetStoredVersion()
Returns
NeedsMigration()
Checks if migration is needed by comparing stored version to current.
public bool NeedsMigration()
Returns
StampCurrentVersion()
Stamps the current schema version after a successful migration or fresh install.
public void StampCurrentVersion()