Migrate the doc from its current version to the target version
		and return it.
773188
def migrate_doc(self, doc):
		
		orig_ver = doc.get(self.version_attribute_name, 0)
		funcs = self._get_migrate_funcs(orig_ver, self.target_version)
		for func in funcs:
			func(self, doc)
			doc[self.version_attribute_name] = func.target
		return doc
657705
def merge(self, name='initial'):
        """"""
        migrator = Migrator(self.database)
        migrate = compile_migrations(migrator, self.migrator.orm.values())
        if not migrate:
            return self.logger.error("Can't merge migrations")

        self.clear()

        self.logger.info('Merge migrations into "%s"', name)
        rollback = compile_migrations(self.migrator, [])
        name = self.compile(name, migrate, rollback, 0)

        migrator = Migrator(self.database)
        self.run_one(name, migrator, fake=True, force=True)
        self.logger.info('Migrations has been merged into "%s"', name)
1196842
def process(self, document):
        """"""
        content = json.dumps(document)

        versions = {}
        versions.update({'Spline': Version(VERSION)})
        versions.update(self.get_version("Bash", self.BASH_VERSION))

        if content.find('"docker(container)":') >= 0 or content.find('"docker(image)":') >= 0:
            versions.update(VersionsCheck.get_version("Docker", self.DOCKER_VERSION))
        if content.find('"packer":') >= 0:
            versions.update(VersionsCheck.get_version("Packer", self.PACKER_VERSION))
        if content.find('"ansible(simple)":') >= 0:
            versions.update(VersionsCheck.get_version('Ansible', self.ANSIBLE_VERSION))

        return versions
620376
private Element migrate(Element root) {
        if (root.getAttributeNode(PLUGIN_VERSION_ATTR) == null) {
            final List<Element> features = toList(root.getElementsByTagName(FEATURE_ELEM));
            final String version = features.stream()
                    .filter(elem -> elem.getAttribute(FEATURE_ID_ATTR).equals("package.version"))
                    .findFirst()
                    .map(elem -> elem.getAttribute(FEATURE_VALUE_ATTR))
                    .orElse("0.0.0");
            root.setAttribute(PLUGIN_VERSION_ATTR, version);
        }
        return root;
    }
961557
private function replaceCurrentVersionbyNewVersion()
    {
        $this->fs->copy($this->newInstallerFile, $this->currentInstallerFile, true);

        return $this;
    }
26583
def allow_migrate(self, db, model):
        
        if db != 'old_nodeshot' or model._meta.app_label != 'oldimporter':
            return False
        return True
911135
def replace(self, resource, id_, document):
        """"""
        args = self._es_args(resource, refresh=True)
        document.pop('_id', None)
        document.pop('_type', None)
        self._update_parent_args(resource, args, document)
        return self.elastic(resource).index(body=document, id=id_, **args)
342660
def migrate(record, dry_run=False):
    ''''''
    handler = record_migration if record else execute_migration
    success = True
    for plugin, package, filename in available_migrations():
        migration = get_migration(plugin, filename)
        if migration or not success:
            log_status(plugin, filename, cyan('Skipped'))
        else:
            status = magenta('Recorded') if record else yellow('Apply')
            log_status(plugin, filename, status)
            script = resource_string(package, join('migrations', filename))
            success &= handler(plugin, filename, script, dryrun=dry_run)
298915
def copy(source):
    ""

    def do_copy(target):
        if source.__doc__:
            target.__doc__ = source.__doc__
        return target

    return do_copy
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);
  });
}
390711
def _MigrateArtifact(artifact):
  """"""
  name = Text(artifact.name)

  try:
    logging.info("Migating %s", name)
    data_store.REL_DB.WriteArtifact(artifact)
    logging.info("  Wrote %s", name)
  except db.DuplicatedArtifactError:
    logging.info("  Skipped %s, because artifact already exists.", name)
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')))
401369
def migrate(app_name=None, revision=None):
    ""
    cmd = ['python bin/manage.py syncdb --migrate']
    if app_name:
        cmd.append(app_name)
        if revision:
            cmd.append(revision)
    verun(' '.join(cmd))
150557
def copyFuncVersionedLib(dest, source, env):
    """"""

    if os.path.isdir(source):
        raise SCons.Errors.UserError("cannot install directory `%s' as a version library" % str(source) )
    else:
        # remove the link if it is already there
        try:
            os.remove(dest)
        except:
            pass
        shutil.copy2(source, dest)
        st = os.stat(source)
        os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
        installShlibLinks(dest, source, env)

    return 0
992910
def revision(directory=None, message=None, autogenerate=False, sql=False,
             head='head', splice=False, branch_label=None, version_path=None,
             rev_id=None):
    """"""
    config = current_app.extensions['migrate'].migrate.get_config(directory)
    if alembic_version >= (0, 7, 0):
        command.revision(config, message, autogenerate=autogenerate, sql=sql,
                         head=head, splice=splice, branch_label=branch_label,
                         version_path=version_path, rev_id=rev_id)
    else:
        command.revision(config, message, autogenerate=autogenerate, sql=sql)
255759
def migrate(connection, dsn):
    
    all_migrations = _get_all_migrations()
    logger.debug('Collected migrations: {}'.format(all_migrations))

    for version, modname in all_migrations:
        if _is_missed(connection, version) and version <= SCHEMA_VERSION:
            logger.info('Missed migration: {} migration is missed. Migrating...'.format(version))
            module = __import__(modname, fromlist='dummy')

            # run each migration under its own transaction. This allows us to apply valid migrations
            # and break on invalid.
            trans = connection.begin()
            try:
                module.Migration().migrate(connection)
                _update_version(connection, version)
                trans.commit()
            except:
                trans.rollback()
                logger.error("Failed to migrate '{}'  on {} ".format(version, dsn))
                raise
463786
function() {
				var doc = this;
				var newDoc = {};
				_.forEach(this, function(v, k) {
					if (doc.hasOwnProperty(k) && !_.startsWith(k, '$')) newDoc[k] = _.clone(v);
				});

				return newDoc;
			}