Upgrades the instance from a DEVELOPMENT instance to a PRODUCTION instance. This cannot be
undone.
181717
@SuppressWarnings("WeakerAccess")
  public UpdateInstanceRequest setProductionType() {
    builder.getInstanceBuilder().setType(Type.PRODUCTION);
    updateFieldMask(Instance.TYPE_FIELD_NUMBER);

    return this;
  }
917546
def clone_object(old_object)
      object = build_from(old_object)
      assign_attributes_for(object, get_model_attributes_from(old_object))

      object
    end
236671
def upgrade():
    """"""
    if op._proxy.migration_context.dialect.name == 'postgresql':
        op.alter_column(
            'records_metadata',
            'json',
            type_=sa.dialects.postgresql.JSONB,
            postgresql_using='json::text::jsonb'
        )
855088
def upgrade():
    """"""
    # table ObjectVersion: modify primary_key
    if op.get_context().dialect.name == 'mysql':
        Fk = 'fk_files_object_bucket_id_files_bucket'
        op.execute(
            'ALTER TABLE files_object '
            'DROP FOREIGN KEY {0}, DROP PRIMARY KEY, '
            'ADD PRIMARY KEY(version_id), '
            'ADD FOREIGN KEY(bucket_id) '
            'REFERENCES files_bucket(id)'.format(Fk))
    else:
        op.drop_constraint('pk_files_object', 'files_object', type_='primary')
        op.create_primary_key(
            'pk_files_object', 'files_object', ['version_id'])
    op.create_unique_constraint(
        'uq_files_object_bucket_id', 'files_object',
        ['bucket_id', 'version_id', 'key'])
    # table ObjectVersionTag: create
    op.create_table(
        'files_objecttags',
        sa.Column(
            'version_id',
            sqlalchemy_utils.types.uuid.UUIDType(),
            nullable=False),
        sa.Column(
            'key',
            sa.Text().with_variant(mysql.VARCHAR(255), 'mysql'),
            nullable=False
        ),
        sa.Column(
            'value',
            sa.Text().with_variant(mysql.VARCHAR(255), 'mysql'),
            nullable=False
        ),
        sa.PrimaryKeyConstraint('version_id', 'key'),
        sa.ForeignKeyConstraint(
            ['version_id'],
            [u'files_object.version_id'],
            ondelete='CASCADE'),
    )
968949
def update(self, instance, validated_data):
        
        instance.title = validated_data.get('title', instance.title)
        instance.code = validated_data.get('code', instance.code)
        instance.linenos = validated_data.get('linenos', instance.linenos)
        instance.language = validated_data.get('language', instance.language)
        instance.style = validated_data.get('style', instance.style)
        instance.save()
        return instance
374863
def upgrade(directory, sql, tag, x_arg, revision):
    """"""
    _upgrade(directory, revision, sql, tag, x_arg)
1222132
public function upgrade()
    {
        $this->upgradeDatabase();

        // now we refresh all blocks
        $manager = new Manager($this->app);
        $items = $manager->driver('block_type')->getItems($this->getPackageEntity());
        foreach ($items as $item) {
            $item->refresh();
        }

        Localization::clearCache();
    }
1103549
def patch(self, instance, errors):
        
        if errors:
            return self.errors(errors)
        return self.updated(instance)
89544
def replace(self, identifier, new_instance):
        
        try:
            # Note that `self.update()` ultimately calls merge, which will not enforce
            # a strict replacement; absent fields will default to the current values.
            return self.update(identifier, new_instance)
        except ModelNotFoundError:
            return self.create(new_instance)
55974
def update(self, instance):
        
        assert isinstance(instance, self.model_klass)
        if instance.db_id:
            query = {'_id': ObjectId(instance.db_id)}
        else:
            query = build_db_query(self.primary_key, instance.key)
        self.ds.update(self.collection_name, query, instance)
        return instance.db_id
103391
def _update_subinstance(self, name, subform):
        """"""
        old_subinstance = getattr(self.instance, name)
        new_subinstance = subform.update_instance()

        # if our instance previously had no node for the subform AND the
        # updated one has data, then attach the new node.
        if old_subinstance is None and not new_subinstance.is_empty():
            setattr(self.instance, name, new_subinstance)

        # on the other hand, if the instance previously had a node for the
        # subform AND the updated one is empty, then remove the node.
        if old_subinstance is not None and new_subinstance.is_empty():
            delattr(self.instance, name)
1120804
def update_source(source, instance)
      begin
        data = instance.fetch
        publish_data(source, data)
      ensure
        @after_update_callback.call
      end
    rescue Exception => ex
      puts "Failed to update #{source}: #{ex.message}"
      puts ex.backtrace
      @error_callback.call(ex)
    end
9056
def update_instances
      instance_group_updater = InstanceGroupUpdater.new(
        ip_provider: @deployment_planner.ip_provider,
        instance_group: @instance_group,
        disk_manager: @disk_manager,
        template_blob_cache: @template_blob_cache,
        dns_encoder: @dns_encoder,
        link_provider_intents: @deployment_planner.link_provider_intents,
      )
      instance_group_updater.update
    end
1201083
def upgrade():
    """"""
    op.create_table(
        'crawler_job',
        sa.Column('id', sa.Integer, primary_key=True, autoincrement=True),
        sa.Column('job_id', UUIDType, index=True),
        sa.Column('spider', sa.String(255), index=True),
        sa.Column('workflow', sa.String(255), index=True),
        sa.Column('results', sa.Text, nullable=True),
        sa.Column(
            'status',
            ChoiceType(JobStatus, impl=sa.String(10)),
            nullable=False
        ),
        sa.Column('logs', sa.Text, nullable=True),
        sa.Column(
            'scheduled',
            sa.DateTime,
            default=datetime.now,
            nullable=False,
            index=True
        )
    )

    op.create_table(
        'crawler_workflows_object',
        sa.Column('job_id', UUIDType, primary_key=True),
        sa.Column(
            'object_id',
            sa.Integer,
            sa.ForeignKey(
                'workflows_object.id',
                ondelete="CASCADE",
                onupdate="CASCADE",
            ),
            primary_key=True
        )
    )
1123495
public void updateInstance(
      Instance my_instance,
      final String my_client_project,
      final String my_instance_id,
      final String my_display_name) {
    // [START instance_admin_client_update_instance]
    Instance instance = my_instance;
    final String clientProject = my_client_project;
    final String instanceId = my_instance_id;

    final String newDisplayName = my_display_name;

    InstanceInfo toUpdate =
        InstanceInfo.newBuilder(InstanceId.of(clientProject, instanceId))
            .setDisplayName(newDisplayName)
            .setNodeCount(instance.getNodeCount() + 1)
            .build();
    // Only update display name
    OperationFuture<Instance, UpdateInstanceMetadata> op =
        instanceAdminClient.updateInstance(toUpdate, InstanceInfo.InstanceField.DISPLAY_NAME);
    try {
      op.get();
    } catch (ExecutionException e) {
      throw (SpannerException) e.getCause();
    } catch (InterruptedException e) {
      throw SpannerExceptionFactory.propagateInterrupt(e);
    }
    // [END instance_admin_client_update_instance]
  }
980005
def upgrade():
    """"""
    op.create_table(
        'transaction',
        sa.Column('issued_at', sa.DateTime(), nullable=True),
        sa.Column('id', sa.BigInteger(), nullable=False),
        sa.Column('remote_addr', sa.String(length=50), nullable=True),
    )
    op.create_primary_key('pk_transaction', 'transaction', ['id'])
    if op._proxy.migration_context.dialect.supports_sequences:
        op.execute(CreateSequence(Sequence('transaction_id_seq')))
238612
def update_instance_variable(variable_name, new_value)
      old_value = instance_variable_get(variable_name).freeze

      instance_variable_set(variable_name.to_sym, new_value)

      unless old_value == new_value
        changed_attributes[variable_name.to_s.delete('@').to_sym] = old_value
      end
    end