----- StorageService: Schema update methods
186123
@Override
    public void deleteApplication(ApplicationDefinition appDef) {
        checkServiceState();
        for(TableDefinition tableDef: appDef.getTableDefinitions().values()) {
            m_logService.deleteTable(Tenant.getTenant(appDef), appDef.getAppName(), tableDef.getTableName());
        }
    }
1236396
private void updateEntityMappers() {
    for (Entry<Integer, EntitySchema> entry : schemaManager.getEntitySchemas(
        tableName, entityName).entrySet()) {
      if (!entityMappers.containsKey(entry.getKey())) {
        AvroEntitySchema writtenSchema = (AvroEntitySchema) entry.getValue();
        EntityMapper<ENTITY> entityMapper = constructWrappedEntityMapper(
            keySchema, entitySchema, writtenSchema, entityClass);
        entityMappers.put(entry.getKey(), entityMapper);
      }
    }
  }
733274
static void loadSchemas(MessageStore msgStore, long[] schemaIds) throws MessageRestoreFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "loadSchemas");
    try {
      // Get the SchemaStore reference, creating a new one if necessary
      SchemaStoreItemStream schemaStore = getSchemaStore(msgStore);

      // Check for any unknown schemas
      for (int i = 0; i < schemaIds.length; i++) {
        if (JMFRegistry.instance.retrieve(schemaIds[i]) == null) {
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Restoring schema:" + schemaIds[i]);
          JMFRegistry.instance.register(schemaStore.findSchema(schemaIds[i]));
        }
      }
    } catch (MessageStoreException e) {
      FFDCFilter.processException(e, "loadSchemas", "105");
      throw new MessageRestoreFailedException(e);
    } catch (JMFException e) {
      FFDCFilter.processException(e, "loadSchemas", "108");
      throw new MessageRestoreFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "loadSchemas");
  }
518291
def _update_cache(self):
        
        fields = connections[self.connection_alias].get_unified_index().all_searchfields()
        if self._fields != fields:
            self._fields = fields
            self._content_field_name, self._schema = self.build_schema(self._fields)
716573
protected function updateSchemaVersionFile() {
    // Write BLT version to blt/.schema-version.
    $latest_update_method_version = $this->updater->getLatestUpdateMethodVersion();
    $schema_file_name = $this->getConfigValue('blt.config-files.schema-version');

    $fs = new Filesystem();
    $fs->dumpFile($schema_file_name, $latest_update_method_version);
  }
1109659
def update(self, *objs):
        
        keys = self.keys()
        new_keys = get_objs_columns(objs, self.realfieldb)

        modified = False
        for v in new_keys:
            if v in keys:    #the id has been existed, so don't insert new record
                keys.remove(v)
            else:
                d = {self.fielda:self.valuea, self.fieldb:v}
                if self.before_save:
                    self.before_save(d)
                if self.through_model:
                    obj = self.through_model(**d)
                    obj.save()
                else:
                    self.do_(self.table.insert().values(**d))
                modified = True
                
        if keys: #if there are still keys, so delete them
            self.clear(*keys)
            modified = True
        
        #cache [] to _STORED_attr_name
        setattr(self.instance, self.store_key, new_keys)
        
        return modified
740614
def update_api_model_schema(restApiId, modelName, schema, region=None, key=None, keyid=None, profile=None):
    '''
    

    '''
    try:
        schema_json = salt.utils.json.dumps(schema) if isinstance(schema, dict) else schema
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        response = _api_model_patch_replace(conn, restApiId, modelName, '/schema', schema_json)
        return {'updated': True, 'model': _convert_datetime_str(response)}
    except ClientError as e:
        return {'updated': False, 'error': __utils__['boto3.get_error'](e)}
663324
def update_service_definitions(self, service_definitions):
        
        content = self._serialize.body(service_definitions, 'VssJsonCollectionWrapper')
        self._send(http_method='PATCH',
                   location_id='d810a47d-f4f4-4a62-a03f-fa1860585c4c',
                   version='5.0-preview.1',
                   content=content)
768440
public static void doMetaUpdateVersionsOnStores(AdminClient adminClient,
                                                        List<StoreDefinition> oldStoreDefs,
                                                        List<StoreDefinition> newStoreDefs) {
            Set<String> storeNamesUnion = new HashSet<String>();
            Map<String, StoreDefinition> oldStoreDefinitionMap = new HashMap<String, StoreDefinition>();
            Map<String, StoreDefinition> newStoreDefinitionMap = new HashMap<String, StoreDefinition>();
            List<String> storesChanged = new ArrayList<String>();
            for(StoreDefinition storeDef: oldStoreDefs) {
                String storeName = storeDef.getName();
                storeNamesUnion.add(storeName);
                oldStoreDefinitionMap.put(storeName, storeDef);
            }
            for(StoreDefinition storeDef: newStoreDefs) {
                String storeName = storeDef.getName();
                storeNamesUnion.add(storeName);
                newStoreDefinitionMap.put(storeName, storeDef);
            }
            for(String storeName: storeNamesUnion) {
                StoreDefinition oldStoreDef = oldStoreDefinitionMap.get(storeName);
                StoreDefinition newStoreDef = newStoreDefinitionMap.get(storeName);
                if(oldStoreDef == null && newStoreDef != null || oldStoreDef != null
                   && newStoreDef == null || oldStoreDef != null && newStoreDef != null
                   && !oldStoreDef.equals(newStoreDef)) {
                    storesChanged.add(storeName);
                }
            }
            System.out.println("Updating metadata version for the following stores: "
                               + storesChanged);
            try {
                adminClient.metadataMgmtOps.updateMetadataversion(adminClient.getAdminClientCluster()
                                                                             .getNodeIds(),
                                                                  storesChanged);
            } catch(Exception e) {
                System.err.println("Error while updating metadata version for the specified store.");
            }
        }
1173678
def update(self):
        """"""
        self.default_val = 0
        #fields = self.fields
        #fields = self.orm_class.depart(self.fields, is_update=True)
        #self.set_fields(fields)
        return self.interface.update(
            self.schema,
            self.fields,
            self
        )
496569
private void doUpgrade(List<StorageDirectory> sds,
                 List<StorageInfo> sdsInfo,
                 final NamespaceInfo nsInfo
                 ) throws IOException {
    assert sds.size() == sdsInfo.size();
    UpgradeThread[] upgradeThreads = new UpgradeThread[sds.size()];
    // start to upgrade
    for (int i=0; i<upgradeThreads.length; i++) {
      final StorageDirectory sd = sds.get(i);
      final StorageInfo si = sdsInfo.get(i);
      UpgradeThread thread = new UpgradeThread(sd, si, nsInfo);
      thread.start();
      upgradeThreads[i] = thread;
    }
    // wait for upgrade to be done
    for (UpgradeThread thread : upgradeThreads) {
      try {
        thread.join();
      } catch (InterruptedException e) {
        throw (InterruptedIOException)new InterruptedIOException().initCause(e);
      }
    }
    // check for errors
    for (UpgradeThread thread : upgradeThreads) {
      if (thread.error != null)
        throw new IOException(thread.error);
    }

    // write version file
    this.layoutVersion = FSConstants.LAYOUT_VERSION;
    assert this.namespaceID == nsInfo.getNamespaceID() :
      "Data-node and name-node layout versions must be the same.";
    this.cTime = nsInfo.getCTime();
    for (StorageDirectory sd :sds) {
      sd.write();
      File prevDir = sd.getPreviousDir();
      File tmpDir = sd.getPreviousTmp();
      // rename tmp to previous
      rename(tmpDir, prevDir);
      LOG.info("Upgrade of " + sd.getRoot()+ " is complete.");
    }
  }
405305
private void updateEntity(String type, String id, XContentBuilder source) throws StorageException {
        try {
            String doc = source.string();
            /* JestResult response = */esClient.execute(new Index.Builder(doc)
                    .setParameter(Parameters.OP_TYPE, "index").index(getIndexName()).type(type).id(id).build()); //$NON-NLS-1$
        } catch (Exception e) {
            throw new StorageException(e);
        }
    }
16194
public static void validateSchemaAsNeeded(StoreDefinition storeDefinition) {
        logger.info("Validating schema for store: " + storeDefinition.getName());
        SerializerDefinition keySerDef = storeDefinition.getKeySerializer();
        // validate the key schemas
        try {
            validateIfAvroSchema(keySerDef);
        } catch(Exception e) {
            logger.error("Validating key schema failed for store:  " + storeDefinition.getName());
            throw new VoldemortException("Error validating key schema for store:  "
                                         + storeDefinition.getName() + " " + e.getMessage(), e);
        }

        // validate the value schemas
        SerializerDefinition valueSerDef = storeDefinition.getValueSerializer();
        try {
            validateIfAvroSchema(valueSerDef);
        } catch(Exception e) {
            logger.error("Validating value schema failed for store:  " + storeDefinition.getName());
            throw new VoldemortException("Error validating value schema for store:  "
                                         + storeDefinition.getName() + " " + e.getMessage(), e);
        }
    }
78952
def update(self, storagemodel:object, modeldefinition = None, hide = 0) -> StorageQueueModel:
        

        if (storagemodel.id != '') and (storagemodel.pop_receipt != '') and (not storagemodel.id is None) and (not storagemodel.pop_receipt is None):
            try:
                content = storagemodel.getmessage()
                message = modeldefinition['queueservice'].update_message(storagemodel._queuename, storagemodel.id, storagemodel.pop_receipt, visibility_timeout = hide, content=content)
                storagemodel.content = content
                storagemodel.pop_receipt = message.pop_receipt

            except Exception as e:
                msg = 'can not update queue message:  queue {} with message.id {!s} because {!s}'.format(storagemodel._queuename, storagemodel.id, e)
                storagemodel = None
                raise AzureStorageWrapException(msg=msg)
        else:
            msg = 'cant update queuemessage in {!s} due to missing id {!s} and/or pop_receipt {!s}'.format(storagemodel._queuename, storagemodel.id, storagemodel.pop_receipt)
            storagemodel = None
            raise AzureStorageWrapException(msg=msg)

        return storagemodel
113759
def update_schema(self, catalog="hypermap"):
        
        schema_url = "{0}/solr/{1}/schema".format(SEARCH_URL, catalog)
        print schema_url

        # create a special type to draw better heatmaps.
        location_rpt_quad_5m_payload = {
            "add-field-type": {
                "name": "location_rpt_quad_5m",
                "class": "solr.SpatialRecursivePrefixTreeFieldType",
                "geo": False,
                "worldBounds": "ENVELOPE(-180, 180, 180, -180)",
                "prefixTree": "packedQuad",
                "distErrPct": "0.025",
                "maxDistErr": "0.001",
                "distanceUnits": "degrees"
            }
        }
        requests.post(schema_url, json=location_rpt_quad_5m_payload)

        # create a special type to implement ngrm text for search.
        text_ngrm_payload = {
            "add-field-type": {
                "name": "text_ngrm",
                "class": "solr.TextField",
                "positionIncrementGap": "100",
                "indexAnalyzer": {
                    "tokenizer": {
                        "class": "solr.WhitespaceTokenizerFactory"
                    },
                    "filters": [
                        {
                            "class": "solr.NGramFilterFactory",
                            "minGramSize": "1",
                            "maxGramSize": "50"
                        }, {
                            "class": "solr.LowerCaseFilterFactory"
                        }
                    ]
                },
                "queryAnalyzer": {
                    "tokenizer": {
                        "class": "solr.WhitespaceTokenizerFactory"
                    },
                    "filters": [
                        {
                            "class": "solr.LowerCaseFilterFactory",
                        }
                    ]
                }
            }
        }
        requests.post(schema_url, json=text_ngrm_payload)

        # now the other fields
        fields = [
            {"name": "abstract", "type": "string"},
            {"name": "abstract_txt", "type": "text_ngrm"},
            {"name": "area", "type": "pdouble"},
            {"name": "availability", "type": "string"},
            {"name": "bbox", "type": "location_rpt_quad_5m"},
            {"name": "domain_name", "type": "string"},
            {"name": "is_public", "type": "boolean"},
            {"name": "is_valid", "type": "boolean"},
            {"name": "keywords", "type": "string", "multiValued": True},
            {"name": "last_status", "type": "boolean"},
            {"name": "layer_category", "type": "string"},
            {"name": "layer_date", "type": "pdate", "docValues": True},
            {"name": "layer_datetype", "type": "string"},
            {"name": "layer_id", "type": "plong"},
            {"name": "layer_originator", "type": "string"},
            {"name": "layer_originator_txt", "type": "text_ngrm"},
            {"name": "layer_username", "type": "string"},
            {"name": "layer_username_txt", "type": "text_ngrm"},
            {"name": "location", "type": "string"},
            {"name": "max_x", "type": "pdouble"},
            {"name": "max_y", "type": "pdouble"},
            {"name": "min_x", "type": "pdouble"},
            {"name": "min_y", "type": "pdouble"},
            {"name": "name", "type": "string"},
            {"name": "recent_reliability", "type": "pdouble"},
            {"name": "reliability", "type": "pdouble"},
            {"name": "service_id", "type": "plong"},
            {"name": "service_type", "type": "string"},
            {"name": "srs", "type": "string", "multiValued": True},
            {"name": "tile_url", "type": "string"},
            {"name": "title", "type": "string"},
            {"name": "title_txt", "type": "text_ngrm"},
            {"name": "type", "type": "string"},
            {"name": "url", "type": "string"},
            {"name": "uuid", "type": "string", "required": True},
            {"name": "centroid_y", "type": "pdouble"},
            {"name": "centroid_x", "type": "pdouble"},
        ]

        copy_fields = [
            {"source": "*", "dest": "_text_"},
            {"source": "title", "dest": "title_txt"},
            {"source": "abstract", "dest": "abstract_txt"},
            {"source": "layer_originator", "dest": "layer_originator_txt"},
            {"source": "layer_username", "dest": "layer_username_txt"},
        ]

        headers = {
            "Content-type": "application/json"
        }

        for field in fields:
            data = {
                "add-field": field
            }
            requests.post(schema_url, json=data, headers=headers)

        for field in copy_fields:
            data = {
                "add-copy-field": field
            }
            print data
            requests.post(schema_url, json=data, headers=headers)
1262377
public function upgradeSchema(Schema $schema)
    {
        $table = $schema->getTable('FileImageThumbnailPaths');
        if ($table->hasIndex('thumbnailPathID')) {
            $table->dropIndex('thumbnailPathID');
        }
        if (!$table->hasColumn('thumbnailFormat')) {
            $table->addColumn(
                'thumbnailFormat',
                'string',
                [
                    'notnull' => true,
                    'default' => '',
                    'length' => 5,
                ]
            );
            $table->setPrimaryKey([
                'fileID',
                'fileVersionID',
                'thumbnailTypeHandle',
                'storageLocationID',
                'thumbnailFormat',
            ]);
        }
    }
454044
function update() {
  if (!windowStorage.supported) return;

  var data = window.name
    , length = 0
    , key;

  storage = data.charAt(0) === prefix
    ? qs.parse(data.slice(1))
    : {};

  for (key in storage) {
    if (has.call(storage, key)) length++;
  }

  windowStorage.length = length;
}