private void UpgradeTo0920(int dbVersion) { const string upgradeVersion1String = "0.9.2"; if (dbVersion < Application.ParseVersion(upgradeVersion1String)) { // delete duplicates _logger.InfoFormat("Performing WU History database upgrade to v{0}...", upgradeVersion1String); var duplicateDeleter = new DuplicateDeleter(this, _logger); OnUpgradeExecuting(duplicateDeleter); // add columns to WuHistory table AddProteinColumns(); // update the WuHistory table with protein info var proteinDataUpdater = new ProteinDataUpdater(this, _proteinService); OnUpgradeExecuting(proteinDataUpdater); // set database version SetDatabaseVersion(upgradeVersion1String); } }
private void UpgradeToVersion092(int dbVersion) { const string upgradeVersionString = "0.9.2"; if (dbVersion < Application.ParseVersion(upgradeVersionString)) { using (var connection = new SQLiteConnection(ConnectionString)) { connection.Open(); using (var transaction = connection.BeginTransaction()) { try { _logger.InfoFormat("Performing WU History database upgrade to v{0}...", upgradeVersionString); // delete duplicates var duplicateDeleter = new DuplicateDeleter(connection, _logger); duplicateDeleter.ExecuteAsyncWithProgress(true).Wait(); // add columns to WuHistory table AddProteinColumns(connection); // update the WuHistory table with protein info var proteinDataUpdater = new ProteinDataUpdater(connection, _proteinService); proteinDataUpdater.ExecuteAsyncWithProgress(true).Wait(); // set database version SetDatabaseVersion(connection, upgradeVersionString); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw new DataException("Database upgrade failed.", ex); } } } } }
private void UpgradeTo0920(int dbVersion) { const string upgradeVersion1String = "0.9.2"; if (dbVersion < Application.ParseVersion(upgradeVersion1String)) { // delete duplicates _logger.InfoFormat("Performing WU History database upgrade to v{0}...", upgradeVersion1String); var duplicateDeleter = new DuplicateDeleter(this, _logger); OnUpgradeExecuting(duplicateDeleter); // add columns to WuHistory table AddProteinColumns(); // update the WuHistory table with protein info var proteinDataUpdater = new ProteinDataUpdater(this, _proteinService); OnUpgradeExecuting(proteinDataUpdater); // set database version SetDatabaseVersion(upgradeVersion1String); } }
public void Upgrade() { string dbVersionString = "0.0.0.0"; if (TableExists(SqlTable.Version)) { string versionFromTable = GetDatabaseVersion(); if (!String.IsNullOrEmpty(versionFromTable)) { dbVersionString = versionFromTable; } } else { CreateTable(SqlTable.Version); } int dbVersion = Application.ParseVersion(dbVersionString); _logger.Info("WU History database v{0}", dbVersionString); bool upgraded = false; const string upgradeVersion1String = "0.9.2.0"; if (dbVersion < Application.ParseVersion(upgradeVersion1String)) { using (var trans = Connection.BeginTransaction()) { _logger.Info("Performing WU History database upgrade to v{0}...", upgradeVersion1String); var duplicateDeleter = new DuplicateDeleter(this, _logger); OnUpgradeExecuting(duplicateDeleter); UpgradeWuHistory1(); var proteinDataUpdater = new ProteinDataUpdater(this, _proteinDictionary); OnUpgradeExecuting(proteinDataUpdater); upgraded = true; trans.Commit(); } } if (upgraded) { SetDatabaseVersion(Application.VersionWithRevision); } }