示例#1
0
 def _migrate(self, repository, version):
     upgrade = True
     err = ""
     version = versioning_api._migrate_version(self.schema, version, upgrade, err)
     changeset = self.schema.changeset(version)
     for ver, change in changeset:
         self.schema.runchange(ver, change, changeset.step)
 def _migrate(self, version, repository=None, downgrade=False):
     repository = repository or self.repo_path
     err = ""
     version = versioning_api._migrate_version(self.schema, version, not downgrade, err)
     changeset = self.schema.changeset(version)
     for ver, change in changeset:
         self.schema.runchange(ver, change, changeset.step)
     self.assertEqual(self.schema.version, version)
 def migrate_fully(self, repo_name):
     abs_path = os.path.abspath(os.path.dirname(repo_name))
     init_version = upgrades.get_init_version(abs_path=abs_path)
     schema = versioning_api.ControlledSchema.create(
         self.migrate_engine, abs_path, init_version)
     max_version = schema.repository.version().version
     upgrade = True
     err = ''
     version = versioning_api._migrate_version(
         schema, max_version, upgrade, err)
     schema.upgrade(version)
示例#4
0
 def _migrate(self, version, repository=None, downgrade=False,
              current_schema=None):
     repository = repository or self.repo_path
     err = ''
     version = versioning_api._migrate_version(self.schema_,
                                               version,
                                               not downgrade,
                                               err)
     if not current_schema:
         current_schema = self.schema_
     changeset = current_schema.changeset(version)
     for ver, change in changeset:
         self.schema_.runchange(ver, change, changeset.step)
     self.assertEqual(self.schema_.version, version)
示例#5
0
    def upgrade(self, version=None, current_schema=None):
        version = version or self.max_version
        err = ""
        upgrade = True
        version = versioning_api._migrate_version(self.schema_, version, upgrade, err)
        if not current_schema:
            current_schema = self.schema_
        changeset = current_schema.changeset(version)
        for ver, change in changeset:
            self.schema_.runchange(ver, change, changeset.step)

        if self.schema_.version != version:
            raise Exception(
                "Actual version (%s) of %s does not equal expected "
                "version (%s)" % (self.schema_.version, self.repo_name, version)
            )