Upgrade for release 4.5 or older.

@return this
963529
@Override
    protected Object readResolve() {
        super.readResolve();

        if (consoleParsers == null) {
            consoleParsers = Lists.newArrayList();

            if (isOlderThanRelease318()) {
                upgradeFrom318();
            }

            for (String  parser : consoleLogParsers) {
                consoleParsers.add(new ConsoleParser(parser));
            }
        }

        return this;
    }
618142
public function Upgrade172to181()
    {
        $this->_batch->addTask('Db_CreateNewTables');
        $this->_batch->addTask('Db_AddPatches', 59);

        $this->_batch->addTask('Echo', $this->_('Make sure to read the changelog as it contains important instructions'));
        $this->_batch->addTask('Echo', $this->_('Check the Code compatibility report for any issues with project specific code!'));

        return true;
    }
358774
public Bucket update() {
    // [START update]
    Bucket updatedBucket = bucket.toBuilder().setVersioningEnabled(true).build().update();
    // [END update]
    return updatedBucket;
  }
36430
public GuidedDecisionTable52 upgrade(GuidedDecisionTable52 source) {

        final GuidedDecisionTable52 destination = source;

        for (BaseColumn column : source.getExpandedColumns()) {
            DTColumnConfig52 dtColumn = null;
            if (column instanceof MetadataCol52) {
                dtColumn = (DTColumnConfig52) column;
            } else if (column instanceof AttributeCol52) {
                dtColumn = (DTColumnConfig52) column;
            } else if (column instanceof ConditionCol52) {
                dtColumn = (DTColumnConfig52) column;
            } else if (column instanceof ActionCol52) {
                dtColumn = (DTColumnConfig52) column;
            }
            if (dtColumn instanceof LimitedEntryCol) {
                dtColumn = null;
            }
            if (dtColumn instanceof BRLVariableColumn) {
                dtColumn = null;
            }
            if (dtColumn != null) {
                final String legacyDefaultValue = dtColumn.defaultValue;
                if (legacyDefaultValue != null) {
                    dtColumn.setDefaultValue(new DTCellValue52(legacyDefaultValue));
                    dtColumn.defaultValue = null;
                }
            }
        }

        return destination;
    }
99595
public Sink update() {
    // [START update]
    Sink updatedSink = sink.toBuilder().setFilter("severity<=ERROR").build().update();
    // [END update]
    return updatedSink;
  }
395076
protected function perform_upgrade() {
		$transactionStartedExternally = $this->db->get_transaction_status();
		if($this->is_upgrade_in_progress()) {
			//ew.  Can't upgrade.
			$this->error_handler(__METHOD__ .": upgrade already in progress...????");
		}
		else {
			$lockConfig = $this->is_upgrade_in_progress(TRUE);
			
			$this->do_log("Starting upgrade process...", 'begin');
			
			if($lockConfig === 0) {
				$this->error_handler(__METHOD__ .": failed to set 'upgrade in progress'");
			}
			else {
				$this->do_log(__METHOD__ .": result of creating lockfile: (". $lockConfig .")", 'debug');
				
				//push data into our internal "config" array.
				$this->read_upgrade_config_file();
				$this->get_database_version();
				
				$versionConflictInfo = $this->check_for_version_conflict();
				
				if(!is_null($versionConflictInfo)) {
					$this->do_log("Upgrading ". $versionConflictInfo ." versions, from " .
							"(". $this->databaseVersion .") to (". $this->versionFileVersion .")", 'info');
				}
				
				$upgradeList = $this->get_upgrade_list();
				try {
					$i=0;
					$this->do_log(__METHOD__ .": starting to run through the upgrade list, starting at (". $this->databaseVersion ."), " .
							"total number of upgrades to perform: ". count($upgradeList), 'debug');
					if(!$transactionStartedExternally) {
						$this->db->beginTrans();
					}
					foreach($upgradeList as $fromVersion=>$toVersion) {
						
						$details = __METHOD__ .": upgrading from ". $fromVersion ." to ". $toVersion ."... ";
						$this->do_log($details, 'system');
						$this->do_single_upgrade($fromVersion, $toVersion);
						$this->get_database_version();
						$i++;
						
						$details = __METHOD__ .": finished upgrade #". $i .", now at version (". $this->databaseVersion .")";
						$this->do_log($details, 'system');
					}
					
					if($i < count($upgradeList)) {
						$this->do_log(__METHOD__ .": completed upgrade ". $i ." of ". count($upgradeList), 'debug');
					}
					else {
						if($this->databaseVersion == $this->versionFileVersion) {
							$this->do_log(__METHOD__ .": finished upgrading after performing (". $i .") upgrades", 'debug');
							$this->newVersion = $this->databaseVersion;
						}
						else {
							$this->do_log(__METHOD__ .": upgradeList::: ". ToolBox::debug_print($upgradeList,0), 'debug');
							$this->error_handler(__METHOD__ .": finished upgrade, but version wasn't updated (expecting '". $this->versionFileVersion ."', got '". $this->databaseVersion ."')!!!");
						}
					}
					$this->lockObj->delete_lockfile();
					
					if(!$transactionStartedExternally) {
						$this->db->commitTrans();
					}
				}
				catch(exception $e) {
					$transactionStatus = $this->db->get_transaction_status(false);
					$this->error_handler(__METHOD__ .": transaction status=(". $transactionStatus ."), upgrade aborted:::". $e->getMessage());
					if(!$transactionStartedExternally) {
						$this->db->rollbackTrans();
					}
				}
				$this->do_log("Upgrade process complete", 'end');
			}
		}
	}
692889
def upgrade():
    """"""
    op.create_table(
        'collection',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=255), nullable=False),
        sa.Column('dbquery', sa.Text(), nullable=True),
        sa.Column('rgt', sa.Integer(), nullable=False),
        sa.Column('lft', sa.Integer(), nullable=False),
        sa.Column('level', sa.Integer(), nullable=False),
        sa.Column('parent_id', sa.Integer(), nullable=True),
        sa.Column('tree_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['parent_id'], ['collection.id'], ondelete='CASCADE'
        ),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_index(
        'collection_level_idx', 'collection', ['level'], unique=False
    )
    op.create_index('collection_lft_idx', 'collection', ['lft'], unique=False)
    op.create_index('collection_rgt_idx', 'collection', ['rgt'], unique=False)
    op.create_index(
        op.f('ix_collection_name'), 'collection', ['name'], unique=True
    )
394511
public Version toLowerCase() {
        return new Version(this.major, this.minor, this.patch,
                copyCase(this.preReleaseParts, false),
                copyCase(this.buildMetaDataParts, false));
    }
1366222
def upgrade():
    """"""
    op.create_table(
        'pidstore_pid',
        sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('pid_type', sa.String(length=6), nullable=False),
        sa.Column('pid_value', sa.String(length=255), nullable=False),
        sa.Column('pid_provider', sa.String(length=8), nullable=True),
        sa.Column('status', sa.CHAR(1), nullable=False),
        sa.Column('object_type', sa.String(length=3), nullable=True),
        sa.Column(
            'object_uuid',
            sqlalchemy_utils.types.uuid.UUIDType(),
            nullable=True
        ),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_index(
        'idx_object', 'pidstore_pid', ['object_type', 'object_uuid'],
        unique=False
    )
    op.create_index('idx_status', 'pidstore_pid', ['status'], unique=False)
    op.create_index(
        'uidx_type_pid', 'pidstore_pid', ['pid_type', 'pid_value'],
        unique=True
    )
    op.create_table(
        'pidstore_recid',
        sa.Column('recid', sa.BigInteger(), nullable=False),
        sa.PrimaryKeyConstraint('recid')
    )
    op.create_table(
        'pidstore_redirect',
        sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=False),
        sa.Column(
            'id',
            sqlalchemy_utils.types.uuid.UUIDType(),
            nullable=False
        ),
        sa.Column('pid_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['pid_id'],
            [u'pidstore_pid.id'],
            onupdate='CASCADE',
            ondelete='RESTRICT'
        ),
        sa.PrimaryKeyConstraint('id')
    )
279629
protected function upgrade541()
    {
        $result = true;
        $doSave = false;
        $configStore = $this->getConfigStore();
        $values = $configStore->load();
        array_walk_recursive($values, function(&$value) use (&$doSave) {
            if (is_string($value) && strpos($value, 'originalInvoiceSource::') !== false) {
                str_replace('originalInvoiceSource::', 'order::', $value);
                $doSave = true;
            }
        });
        if ($doSave) {
            $result = $this->save($values);
        }

        return $result;
    }
1366328
protected function setReleaseVersion()
    {
        try {
            $currentVersion = Context::get('version-persister')->getCurrentVersion();
        } catch (\Exception $e) {
            $currentVersion = Context::get('version-generator')->getInitialVersion();
        }

        $this->releaseVersion = Context::get('version-generator')->generateNextVersion($currentVersion);
    }
850399
protected function updateComposerConfig()
    {
        parent::updateComposerConfig();
        $this->composerManager->updateProjectConfig(array(
            'name' => $this->composerManager->createPackageName($this->projectName),
            'license' => 'proprietary',
            'description' => null,
            'extra' => array('branch-alias' => null),
        ));

        return $this;
    }
719384
public java.util.List<UpgradeTarget> getValidUpgradeTarget() {
        if (validUpgradeTarget == null) {
            validUpgradeTarget = new com.amazonaws.internal.SdkInternalList<UpgradeTarget>();
        }
        return validUpgradeTarget;
    }
63309
public Blob update() {
    // [START update]
    Map<String, String> newMetadata = new HashMap<>();
    newMetadata.put("key", "value");
    blob.toBuilder().setMetadata(null).build().update();
    Blob updatedBlob = blob.toBuilder().setMetadata(newMetadata).build().update();
    // [END update]
    return updatedBlob;
  }
90874
public EKBCommit addUpdate(Object update) {
        if (update != null) {
            checkIfModel(update);
            updates.add((OpenEngSBModel) update);
        }
        return this;
    }
186895
@Override
    public void upgrade() {
        // All default rotation strategy settings.
        final MessageCountRotationStrategyConfig messageCountRotationStrategyConfig = clusterConfigService.get(MessageCountRotationStrategyConfig.class);
        final SizeBasedRotationStrategyConfig sizeBasedRotationStrategyConfig = clusterConfigService.get(SizeBasedRotationStrategyConfig.class);
        final TimeBasedRotationStrategyConfig timeBasedRotationStrategyConfig = clusterConfigService.get(TimeBasedRotationStrategyConfig.class);

        if (messageCountRotationStrategyConfig == null) {
            final MessageCountRotationStrategyConfig countConfig = MessageCountRotationStrategyConfig.create(elasticsearchConfiguration.getMaxDocsPerIndex());
            clusterConfigService.write(countConfig);
            LOG.info("Migrated \"{}\" setting: {}", "elasticsearch_max_docs_per_index", countConfig);
        }
        if (sizeBasedRotationStrategyConfig == null) {
            final SizeBasedRotationStrategyConfig sizeConfig = SizeBasedRotationStrategyConfig.create(elasticsearchConfiguration.getMaxSizePerIndex());
            clusterConfigService.write(sizeConfig);
            LOG.info("Migrated \"{}\" setting: {}", "elasticsearch_max_size_per_index", sizeConfig);
        }
        if (timeBasedRotationStrategyConfig == null) {
            final TimeBasedRotationStrategyConfig timeConfig = TimeBasedRotationStrategyConfig.create(elasticsearchConfiguration.getMaxTimePerIndex());
            clusterConfigService.write(timeConfig);
            LOG.info("Migrated \"{}\" setting: {}", "elasticsearch_max_time_per_index", timeConfig);
        }

        // All default retention strategy settings
        final ClosingRetentionStrategyConfig closingRetentionStrategyConfig = clusterConfigService.get(ClosingRetentionStrategyConfig.class);
        final DeletionRetentionStrategyConfig deletionRetentionStrategyConfig = clusterConfigService.get(DeletionRetentionStrategyConfig.class);

        if (closingRetentionStrategyConfig == null) {
            final ClosingRetentionStrategyConfig closingConfig = ClosingRetentionStrategyConfig.create(elasticsearchConfiguration.getMaxNumberOfIndices());
            clusterConfigService.write(closingConfig);
            LOG.info("Migrated \"{}\" setting: {}", "elasticsearch_max_number_of_indices", closingConfig);
        }

        if (deletionRetentionStrategyConfig == null) {
            final DeletionRetentionStrategyConfig deletionConfig = DeletionRetentionStrategyConfig.create(elasticsearchConfiguration.getMaxNumberOfIndices());
            clusterConfigService.write(deletionConfig);
            LOG.info("Migrated \"{}\" setting: {}", "elasticsearch_max_number_of_indices", deletionConfig);
        }

        // Selected rotation and retention strategies.
        final IndexManagementConfig indexManagementConfig = clusterConfigService.get(IndexManagementConfig.class);
        if (indexManagementConfig == null) {
            final Class<? extends RotationStrategy> rotationStrategyClass;
            switch (elasticsearchConfiguration.getRotationStrategy()) {
                case "size":
                    rotationStrategyClass = SizeBasedRotationStrategy.class;
                    break;
                case "time":
                    rotationStrategyClass = TimeBasedRotationStrategy.class;
                    break;
                case "count":
                    rotationStrategyClass = MessageCountRotationStrategy.class;
                    break;
                default:
                    LOG.warn("Unknown retention strategy \"{}\"", elasticsearchConfiguration.getRotationStrategy());
                    rotationStrategyClass = MessageCountRotationStrategy.class;
            }

            final Class<? extends RetentionStrategy> retentionStrategyClass;
            switch (elasticsearchConfiguration.getRetentionStrategy()) {
                case "close":
                    retentionStrategyClass = ClosingRetentionStrategy.class;
                    break;
                case "delete":
                    retentionStrategyClass = DeletionRetentionStrategy.class;
                    break;
                default:
                    LOG.warn("Unknown retention strategy \"{}\"", elasticsearchConfiguration.getRetentionStrategy());
                    retentionStrategyClass = DeletionRetentionStrategy.class;
            }

            final IndexManagementConfig config = IndexManagementConfig.create(
                    rotationStrategyClass.getCanonicalName(),
                    retentionStrategyClass.getCanonicalName());
            clusterConfigService.write(config);
            LOG.info("Migrated \"{}\" and \"{}\" setting: {}", "rotation_strategy", "retention_strategy", config);
        }

        final SearchesClusterConfig searchesClusterConfig = clusterConfigService.get(SearchesClusterConfig.class);
        if (searchesClusterConfig == null) {
            final SearchesClusterConfig config = SearchesClusterConfig.createDefault();
            LOG.info("Creating searches cluster config: {}", config);
            clusterConfigService.write(config);
        }
    }
410553
def upgrade():
    """"""
    op.create_table(
        'accounts_role',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=80), nullable=True),
        sa.Column('description', sa.String(length=255), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('name')
    )
    op.create_table(
        'accounts_user',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('email', sa.String(length=255), nullable=True),
        sa.Column('password', sa.String(length=255), nullable=True),
        sa.Column('active', sa.Boolean(name='active'), nullable=True),
        sa.Column('confirmed_at', sa.DateTime(), nullable=True),
        sa.Column('last_login_at', sa.DateTime(), nullable=True),
        sa.Column('current_login_at', sa.DateTime(), nullable=True),
        sa.Column('last_login_ip',
                  sqlalchemy_utils.types.ip_address.IPAddressType(),
                  nullable=True),
        sa.Column('current_login_ip',
                  sqlalchemy_utils.types.ip_address.IPAddressType(),
                  nullable=True),
        sa.Column('login_count', sa.Integer(), nullable=True),
        sa.PrimaryKeyConstraint('id'),
        sa.UniqueConstraint('email')
    )
    op.create_table(
        'accounts_user_session_activity',
        sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=False),
        sa.Column('sid_s', sa.String(length=255), nullable=False),
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['user_id'], [u'accounts_user.id'],
            name='fk_accounts_session_activity_user_id',
        ),
        sa.PrimaryKeyConstraint('sid_s')
    )
    op.create_table(
        'accounts_userrole',
        sa.Column('user_id', sa.Integer(), nullable=True),
        sa.Column('role_id', sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ['role_id'], ['accounts_role.id'],
            name='fk_accounts_userrole_role_id',
        ),
        sa.ForeignKeyConstraint(
            ['user_id'], ['accounts_user.id'],
            name='fk_accounts_userrole_user_id',
        ),
    )
    with op.batch_alter_table('transaction') as batch_op:
        batch_op.add_column(sa.Column(
            'user_id',
            sa.Integer(),
            sa.ForeignKey('accounts_user.id'),
            nullable=True,
        ))
        batch_op.create_index(
            op.f('ix_transaction_user_id'), ['user_id'], unique=False
        )