Example #1
0
    def action(self):
        db = dbstore.connect(self.cfg.dbPath, self.cfg.dbDriver)
        if self.options.create:
            print >> sys.stderr, "Force-creating database schema ..."
            db.loadSchema()
            schema.createSchema(db, cfg=self.cfg)
        else:
            schema.loadSchema(db, self.cfg, self.options.should_migrate)

        return 0
Example #2
0
    def newMintCfg(self, name):
        cfg = FixtureCache.newMintCfg(self, name)
        cfg.dbDriver = 'sqlite'
        cfg.dbPath = os.path.join(cfg.dataPath, 'mintdb')

        reposDBPath = os.path.join(cfg.dataPath, 'repos', '%s', 'sqldb')
        cfg.configLine('database default sqlite ' + reposDBPath)

        from mint.db import schema
        db = dbstore.connect(cfg.dbPath, cfg.dbDriver)
        schema.loadSchema(db, cfg)

        return cfg
Example #3
0
    def newMintCfg(self, name):
        dbName = ("mf%s" % name).lower().replace('.', '__')
        self.keepDbs.append(dbName)
        db = self.harness.getDB(dbName)

        cfg = FixtureCache.newMintCfg(self, name)
        cfg.dbDriver = self.driver
        cfg.dbPath = self._getConnectStringForDb(dbName)

        reposDBPath = self._getConnectStringForDb()
        cfg.configLine('database default %s %s' % (self.driver, reposDBPath))

        from mint.db import schema
        schema.loadSchema(db.connect(), cfg)
        db.stop()

        return cfg
Example #4
0
 def handle(self, *args, **options):
     dbVersion = models.DatabaseVersion(
         version=schema.RBUILDER_DB_VERSION.major,
         minor=schema.RBUILDER_DB_VERSION.minor)
     dbVersion.save()
     db = dbstore.connect(settings.DATABASES['default']['NAME'], 'sqlite')
     version = schema.loadSchema(db, should_migrate=True)
     print "Migrated rBuilder schema to %s" % version
Example #5
0
 def forked():
     server.check = lambda: True
     from mint.db import schema
     db = server.connect(dbname)
     schema.loadSchema(db, should_migrate=True)
Example #6
0
 def createSchema(self, db):
     from mint.db import schema
     schema.loadSchema(db)
     db.commit()
Example #7
0
 def createSchema(self):
     db = self.connect()
     schema.loadSchema(db)
     db.commit()