Пример #1
0
 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);
    }
 }
Пример #2
0
 public Task UpdateProteinDataAsync(ProteinUpdateType type, long updateArg, CancellationToken cancellationToken, IProgress<ProgressChangedEventArgs> progress)
 {
    // update the WuHistory table with protein info
    var proteinDataUpdater = new ProteinDataUpdater(this, _proteinService);
    proteinDataUpdater.UpdateType = type;
    proteinDataUpdater.UpdateArg = updateArg;
    return proteinDataUpdater.ExecuteAsync(cancellationToken, progress);
 }
Пример #3
0
        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);
             }
        }