Path: redb/redb.Core/Exceptions/RedbSchemaNewerException.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Core/Exceptions/RedbSchemaNewerException.cs ---- namespace redb.Core.Exceptions; /// /// The database carries a redb module (or, on SQLite, a file schema) newer than this package's, and that newer module /// does not serve this package. Start-up stops and leaves the database as it is. /// /// /// A package never puts its own, older module over a newer one: a node of the previous version in a cluster that is /// being upgraded would otherwise take the database back for every node. When the newer module still serves this /// package (it says so itself: pvt_module_compat() on PostgreSQL and SQL Server, the _schema_compat row /// of a SQLite file) the start goes on with a warning; when it does not, this exception is thrown. The way out is /// upgrading the redb packages of this application. /// /// /// /// A sibling of , not a case of it: that one asks for the database to be /// upgraded, this one for the application. /// /// public class RedbSchemaNewerException : Exception { /// Module version (SQLite: file schema version) the database reports. public string DeployedVersion { get; } /// Module version (SQLite: file schema version) this package ships. public string PackageVersion { get; } /// /// The redb package version from which on the database is served, as the database itself states it; null /// when the database states nothing (a module without the compatibility function, a file without the row). /// public string? RequiredPackageVersion { get; } /// Provider name as the dialect reports it. public string Provider { get; } public RedbSchemaNewerException(string provider, string deployedVersion, string packageVersion, string? requiredPackageVersion) : base(BuildMessage(provider, deployedVersion, packageVersion, requiredPackageVersion)) { Provider = provider; DeployedVersion = deployedVersion; PackageVersion = packageVersion; RequiredPackageVersion = requiredPackageVersion; } /// /// For a caller outside the service start, such as a tool, that reads the version and judges it itself: the same /// first sentence, then the caller's own way out instead of upgrading the application's packages. /// /// Provider name as the dialect reports it. /// Module version (SQLite: file schema version) the database reports. /// Module version (SQLite: file schema version) this package ships. /// The package version the database names as served from, null when it names none. /// What the operator does about it: the closing sentence of the message. public RedbSchemaNewerException( string provider, string deployedVersion, string packageVersion, string? requiredPackageVersion, string remedy) : base($"{Newer(provider, deployedVersion, packageVersion, requiredPackageVersion)} The database was left unchanged. {remedy}") { Provider = provider; DeployedVersion = deployedVersion; PackageVersion = packageVersion; RequiredPackageVersion = requiredPackageVersion; } private static string BuildMessage(string provider, string deployed, string package, string? requiredPackage) => $"{Newer(provider, deployed, package, requiredPackage)} " + "Upgrade the redb packages of this application; the database was left unchanged."; /// The first sentence of every message: what is deployed, what this package ships, what the database asks for. private static string Newer(string provider, string deployed, string package, string? requiredPackage) { var needs = requiredPackage is null ? "it does not state which packages it serves" : $"it needs redb packages from {requiredPackage} on"; return $"The {provider} database carries the redb module {deployed}, newer than {package} of this package, and {needs}."; } }