Package version

Resolving and persisting the simulator-package version.

ModelManager.getDBPackageVersionMethod
getDBPackageVersion(sim::AbstractSimulator, db::SQLite.DB)::VersionNumber

Return the package version recorded in db under dbVersionTableName(sim).

If the table does not exist it is created and stamped with the version this session is running. Throws if that version cannot be determined.

Arguments

  • sim::AbstractSimulator: the active simulator backend.
  • db::SQLite.DB: the project database.

Returns

The recorded VersionNumber.

Example

ModelManager.getDBPackageVersion(simulator(), centralDB())
source
ModelManager.getInstalledVersionMethod
getInstalledVersion(sim::AbstractSimulator)::VersionNumber

Return the version of sim's package as installed in the active environment — what Pkg.status prints, and what Pkg.update changes.

Not necessarily the version running: migrations target the version loaded in this session, and the two differ when the environment changes while a session is open.

The package is the one defining typeof(sim).

Arguments

  • sim::AbstractSimulator: the active simulator backend.

Returns

The installed VersionNumber.

Example

ModelManager.getInstalledVersion(simulator())
source
ModelManager.resolvePackageVersionMethod
resolvePackageVersion(sim::AbstractSimulator, db::SQLite.DB; auto_upgrade::Bool=false)::Bool

Compare the version recorded in db with the version loaded in this session and upgrade to it if needed. Returns true when the database is ready to use, false when it is not.

When no loaded version can be determined, the project opens unmigrated and untracked, with a warning.

Arguments

  • sim::AbstractSimulator: the active simulator backend.
  • db::SQLite.DB: the project database.

Keywords

  • auto_upgrade::Bool=false: apply migrations without prompting.

Returns

true if the database is at the loaded version, already or after a successful migration, and also when no loaded version can be determined; false if the database is ahead of the loaded version, or a migration failed.

Example

ModelManager.resolvePackageVersion(simulator(), centralDB(); auto_upgrade=true)
source