Exemple #1
0
 def upgrade_thd(engine):
     querylog.log_from_engine(engine)
     schema = migrate.versioning.schema.ControlledSchema(engine, self.db.model.repo_path)
     changeset = schema.changeset(target_version)
     for version, change in changeset:
         log.msg("upgrading to schema version %d" % (version + 1))
         schema.runchange(version, change, 1)
Exemple #2
0
 def upgrade_thd(engine):
     querylog.log_from_engine(engine)
     schema = migrate.versioning.schema.ControlledSchema(
         engine, self.db.model.repo_path)
     changeset = schema.changeset(target_version)
     for version, change in changeset:
         log.msg('upgrading to schema version %d' % (version + 1))
         schema.runchange(version, change, 1)
Exemple #3
0
    def setUpUpgradeTest(self):
        # set up the "real" db if desired
        if self.use_real_db:
            # note this changes self.db_url
            wfd = defer.waitForDeferred(
                self.setUpRealDatabase(sqlite_memory=False))
            yield wfd
            wfd.getResult()

        self.basedir = None

        if self.source_tarball:
            tarball = util.sibpath(__file__, self.source_tarball)
            if not os.path.exists(tarball):
                raise unittest.SkipTest(
                    "'%s' not found (normal when not building from Git)"
                    % tarball)

            tf = tarfile.open(tarball)
            prefixes = set()
            for inf in tf:
                tf.extract(inf)
                prefixes.add(inf.name.split('/', 1)[0])
            tf.close()
            # (note that tf.extractall isn't available in py2.4)

            # get the top-level dir from the tarball
            assert len(prefixes) == 1, "tarball has multiple top-level dirs!"
            self.basedir = prefixes.pop()
        else:
            if not os.path.exists("basedir"):
                os.makedirs("basedir")
            self.basedir = os.path.abspath("basedir")

        master = fakemaster.make_master()
        master.config.db['db_url'] = self.db_url
        self.db = connector.DBConnector(master, self.basedir)
        wfd = defer.waitForDeferred(
            self.db.setup(check_version=False))
        yield wfd
        wfd.getResult()

        querylog.log_from_engine(self.db.pool.engine)
Exemple #4
0
    def setUpUpgradeTest(self):
        # set up the "real" db if desired
        if self.use_real_db:
            # note this changes self.db_url
            yield self.setUpRealDatabase(sqlite_memory=False)

        self.basedir = None

        if self.source_tarball:
            tarball = util.sibpath(__file__, self.source_tarball)
            if not os.path.exists(tarball):
                raise unittest.SkipTest(
                    "'%s' not found (normal when not building from Git)"
                    % tarball)

            tf = tarfile.open(tarball)
            prefixes = set()
            for inf in tf:
                tf.extract(inf)
                prefixes.add(inf.name.split('/', 1)[0])
            tf.close()
            # (note that tf.extractall isn't available in py2.4)

            # get the top-level dir from the tarball
            assert len(prefixes) == 1, "tarball has multiple top-level dirs!"
            self.basedir = prefixes.pop()
        else:
            if not os.path.exists("basedir"):
                os.makedirs("basedir")
            self.basedir = os.path.abspath("basedir")

        self.master = master = fakemaster.make_master()
        master.config.db['db_url'] = self.db_url
        self.db = connector.DBConnector(self.basedir)
        self.db.setServiceParent(master)
        yield self.db.setup(check_version=False)

        querylog.log_from_engine(self.db.pool.engine)
Exemple #5
0
 def setup_logging(_):
     querylog.log_from_engine(self.db.pool.engine)
Exemple #6
0
 def setup_logging(_):
     querylog.log_from_engine(self.db.pool.engine)