/// <summary> /// Uninstall the database part of a Cuyaghoga component. /// </summary> public void Uninstall() { if (CanUninstall) { log.Info("Uninstalling module with " + this._installScriptFile); DatabaseUtil.ExecuteSqlScript(this._uninstallScriptFile); } else { throw new InvalidOperationException("Can't uninstall assembly from: " + this._installRootDirectory); } }
/// <summary> /// Uninstall the database part of a Cuyaghoga component. /// </summary> public void Uninstall() { if (CanUninstall) { log.Info(string.Format("Uninstalling module with {0}", _installScriptFile)); DatabaseUtil.ExecuteSqlScript(_uninstallScriptFile); } else { throw new InvalidOperationException(string.Format("Can't uninstall assembly from: {0}", _installRootDirectory)); } }
/// <summary> /// Upgrade the database part of a Cuyahoga component to higher version. /// </summary> public void Upgrade() { if (CanUpgrade) { log.Info("Upgrading " + this._assembly.GetName().Name); // Iterate through the sorted versions that are extracted from the upgrade script names. foreach (Version version in this._upgradeScriptVersions) { // Only run the script if the version is higher than the current database version if (version > this._currentVersionInDatabase) { string upgradeScriptPath = Path.Combine(this._databaseScriptsDirectory, version.ToString(3) + ".sql"); log.Info("Running upgrade script " + upgradeScriptPath); DatabaseUtil.ExecuteSqlScript(upgradeScriptPath); this._currentVersionInDatabase = version; } } } else { throw new InvalidOperationException("Can't upgrade assembly from: " + this._installRootDirectory); } }