On upgrade.

@param db
the db
@param oldVersion
the old version
@param newVersion
the new version
480145
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		if (AbstractDataSource.this.options.databaseLifecycleHandler != null) {
			AbstractDataSource.this.options.databaseLifecycleHandler.onUpdate(db, oldVersion, newVersion, true);
			versionChanged = true;
		}
	}
825970
public void setTableVersions(java.util.Collection<TableVersion> tableVersions) {
        if (tableVersions == null) {
            this.tableVersions = null;
            return;
        }

        this.tableVersions = new java.util.ArrayList<TableVersion>(tableVersions);
    }
1318087
public boolean isModifiedOnVersion(String version) {
		if (version == null || version.isEmpty()) {
			return true;
		}
		for (ModificationRecord record : this.modificationRecordList) {
			if (record.isModifiedOnVersion(version)) {
				return true;
			}
		}
		return false;
	}
250476
def set_version(db, name, major_version, minor_version):
    
    version = pack_version(major_version, minor_version)
    db.execute(SET_VERSION_SQL, dict(name=name, version=version))
1007976
function(db, trans, is_caller_setversion) {

    var action = is_caller_setversion ? 'changing' : 'upgrading';
    goog.log.finer(me.logger, action + ' version to ' + db.version +
        ' from ' + old_version);

    // create store that we don't have previously
    for (var i = 0; i < schema.stores.length; i++) {
      // this is sync process.
      me.update_store_(db, trans, schema.stores[i]);
    }

    // delete stores
    var storeNames = /** @type {DOMStringList} */ (db.objectStoreNames);
    for (var n = storeNames.length, i = 0; i < n; i++) {
      if (!schema.hasStore(storeNames[i])) {
        db.deleteObjectStore(storeNames[i]);
        goog.log.finer(me.logger, 'store: ' + storeNames[i] + ' deleted.');
      }
    }
  }
764511
public void setCompileVersion(String version) {
        if (version == null || ClassUtils.isBeforeJava6(version)) {
            JavassistCompiler javassistCompiler = new JavassistCompiler();
            javassistCompiler.setLogger(logger);
            javassistCompiler.setCodeDirectory(codeDirectory);
            compiler = javassistCompiler;
        } else {
            JdkCompiler jdkCompiler = new JdkCompiler();
            jdkCompiler.setCompileVersion(version);
            jdkCompiler.setLogger(logger);
            jdkCompiler.setCodeDirectory(codeDirectory);
            compiler = jdkCompiler;
        }
    }
776364
def _db_upgrade(self, db_name):
        
        current_db_version = self._get_db_version()
        self._execute(db_schema.functions)
        for i in range(current_db_version, nipap.__db_version__):
            self._logger.info("Upgrading DB schema:", i, "to", i+1)
            upgrade_sql = db_schema.upgrade[i-1] # 0 count on array
            self._execute(upgrade_sql % (db_name))
        self._execute(db_schema.triggers)
193570
public void setVersions(java.util.Collection<VersionSummary> versions) {
        if (versions == null) {
            this.versions = null;
            return;
        }

        this.versions = new java.util.ArrayList<VersionSummary>(versions);
    }
771772
public void upgradeTo(String version) throws Exception
    {
    	String installedVersion = systemInfo.getGpVersion();
    	if(!installedVersion.equals(version))
    	{
    		ServerVersionUpgrader upgrader = versionUpgrader(installedVersion, version);
    		upgrader.upgrade(sessionService);
    		
    		String newInstalledVersion = upgrader.upgradedTo() != null ? upgrader.upgradedTo() : version;
    		systemInfo.setGpVersion(newInstalledVersion);
			upgradeTo(version);
    	}
    	
		systDao.store(systemInfo);
    }
1030949
@Override
  protected void updateEntity(DbEntityOperation operation) {

    final DbEntity dbEntity = operation.getEntity();

    String updateStatement = dbSqlSessionFactory.getUpdateStatement(dbEntity);
    ensureNotNull("no update statement for " + dbEntity.getClass() + " in the ibatis mapping files", "updateStatement", updateStatement);

    LOG.executeDatabaseOperation("UPDATE", dbEntity);

    if (Context.getProcessEngineConfiguration().isJdbcBatchProcessing()) {
      // execute update
      executeUpdate(updateStatement, dbEntity);
    } else {
      // execute update
      int numOfRowsUpdated = executeUpdate(updateStatement, dbEntity);

      if (dbEntity instanceof HasDbRevision) {
        if (numOfRowsUpdated != 1) {
          // failed with optimistic locking
          operation.setFailed(true);
          return;
        } else {
          // increment revision of our copy
          HasDbRevision versionedObject = (HasDbRevision) dbEntity;
          versionedObject.setRevision(versionedObject.getRevisionNext());
        }
      }
    }

    // perform post update action
    entityUpdated(dbEntity);
  }
92695
public function upgrade(Table $old_table)
        {
            $old_columns = $old_table->getColumns();
            $new_columns = $this->getColumns();

            $added_columns = \array_diff_key($new_columns, $old_columns);
            $altered_columns = Tools::array_diff_recursive($old_columns, $new_columns);
            $dropped_columns = \array_keys(array_diff_key($old_columns, $new_columns));

            /** @var RawQuery[] $queries */
            $queries = [];
            foreach ($added_columns as $details) {
                $queries[] = $this->getAddColumnQuery($details);
            }

            foreach ($queries as $query) {
                if ($query instanceof QueryInterface) {
                    Statement::getPreparedStatement($query)->execute();
                }
            }

            $this->migrateData($old_table);

            $queries = [];
            foreach ($altered_columns as $column => $details) {
                if (in_array($column, $dropped_columns)) continue;

                $queries[] = $this->getAlterColumnQuery($new_columns[$column]);
                $queries[] = $this->getAlterColumnDefaultQuery($new_columns[$column]);
            }
            foreach ($dropped_columns as $details) {
                $queries[] = $this->getDropColumnQuery($details);
            }
            foreach ($queries as $query) {
                if ($query instanceof RawQuery) {
                    Statement::getPreparedStatement($query)->execute();
                }
            }
        }
702590
def db_upgrade(version=None):
    """"""
    v1 = get_db_version()
    migrate_api.upgrade(url=db_url, repository=db_repo, version=version)
    v2 = get_db_version()

    if v1 == v2:
        print 'Database already up-to-date.'
    else:
        print 'Upgraded: %s ... %s' % (v1, v2)
1371897
public static void checkVersionUpgradable(int oldVersion) 
                                     throws IOException {
    if (oldVersion > LAST_UPGRADABLE_LAYOUT_VERSION) {
      String msg = "*********** Upgrade is not supported from this older" +
                   " version of storage to the current version." + 
                   " Please upgrade to " + LAST_UPGRADABLE_HADOOP_VERSION +
                   " or a later version and then upgrade to current" +
                   " version. Old layout version is " + 
                   (oldVersion == 0 ? "'too old'" : (""+oldVersion)) +
                   " and latest layout version this software version can" +
                   " upgrade from is " + LAST_UPGRADABLE_LAYOUT_VERSION +
                   ". ************";
      LOG.error(msg);
      throw new IOException(msg); 
    }
    
  }
914429
public void executeUpgrades(final List<Class<? extends UpgradeItem>> classes) throws UpgradeException {
        final Connection connection = getConnection(qm);
        final UpgradeMetaProcessor installedUpgrades = new UpgradeMetaProcessor(connection);
        DbUtil.initPlatformName(connection); // Initialize DbUtil

        // First, we need to ensure the schema table is populated on a clean install
        // But we do so without passing any version.
        try {
            installedUpgrades.updateSchemaVersion(null);
        } catch (SQLException e) {
            LOGGER.error("Failed to update schema version", e);
            return;
        }

        for (final Class<? extends UpgradeItem> upgradeClass : classes) {
            try {
                @SuppressWarnings("unchecked")
                final Constructor constructor = upgradeClass.getConstructor();
                final UpgradeItem upgradeItem = (UpgradeItem) constructor.newInstance();

                if (upgradeItem.shouldUpgrade(qm, connection)) {
                    if (!installedUpgrades.hasUpgradeRan(upgradeClass)) {
                        LOGGER.info("Upgrade class " + upgradeClass.getName() + " about to run.");
                        final long startTime = System.currentTimeMillis();
                        upgradeItem.executeUpgrade(qm, connection);
                        final long endTime = System.currentTimeMillis();
                        installedUpgrades.installUpgrade(upgradeClass, startTime, endTime);
                        installedUpgrades.updateSchemaVersion(new VersionComparator(upgradeItem.getSchemaVersion()));
                        LOGGER.info("Completed running upgrade class " + upgradeClass.getName() + " in " + (endTime - startTime) + " ms.");
                    } else {
                        LOGGER.debug("Upgrade class " + upgradeClass.getName() + " has already ran, skipping.");
                    }
                } else {
                    LOGGER.debug("Upgrade class " + upgradeClass.getName() + " does not need to run.");
                }
            } catch (Exception e) {
                DbUtil.rollback(connection);
                LOGGER.error("Error in executing upgrade class: " + upgradeClass.getName(), e);
                throw new UpgradeException(e);
            }
        }
    }
305031
public static void setVersion(JsonNode node, Long version) {
		obj(node).put(ID_VERSION, version);
	}
236228
public void setVersion(final String version) {
        if (version == null && this.version == null) {
            return;
        } else if (version == null) {
            removeChild(this.version);
            this.version = null;
        } else if (this.version == null) {
            this.version = new KeyValueNode<String>(CommonConstants.CS_VERSION_TITLE, version);
            appendChild(this.version, false);
        } else {
            this.version.setValue(version);
        }
    }
154371
function runMigrations(db, currentVersion) {
  return new Promise((resolve, reject) => {
    const nextVersion = currentVersion + 1;

    if (!migrations[nextVersion]) {
      return resolve();
    }

    if (debug) {
      console.log('Migrating schema to v%d', nextVersion);
    }
    migrations[nextVersion](db)
      .then(() => {
        // write new schemaVersion file
        const json = JSON.stringify({ schemaVersion: nextVersion });
        fs.writeFile(schemaVersionFilePath, json, err => {
          if (err) {
            return reject(err);
          }
          resolve(runMigrations(db, nextVersion));
        });
      })
      .catch(reject);
  });
}