def cmd_install(self, params): pgq_objs = [ skytools.DBLanguage("plpgsql"), skytools.DBFunction("txid_current_snapshot", 0, sql_file="txid.sql"), skytools.DBSchema("pgq", sql_file="pgq.sql"), skytools.DBSchema("pgq_ext", sql_file="pgq_ext.sql"), skytools.DBSchema("pgq_node", sql_file="pgq_node.sql"), ] londiste_objs = pgq_objs + [ skytools.DBSchema("londiste", sql_file="londiste.sql"), ] mod_map = { 'londiste': londiste_objs, 'pgq': pgq_objs, } mod_name = params['module'] objs = mod_map[mod_name] if not self.db: print "no db?" return curs = self.db.cursor() skytools.db_install(curs, objs, None) print "INSTALL"
def installer(self): objs = [ skytools.DBLanguage("plpgsql"), #skytools.DBFunction("txid_current_snapshot", 0, sql_file="txid.sql"), skytools.DBSchema("pgq", sql_file="pgq.sql"), ] db = self.get_database('db') curs = db.cursor() skytools.db_install(curs, objs, self.log) db.commit()
def install_code(self, db): """Install cascading code to db.""" objs = [ skytools.DBLanguage("plpgsql"), skytools.DBFunction("txid_current_snapshot", 0, sql_file="txid.sql"), skytools.DBSchema("pgq", sql_file="pgq.sql"), skytools.DBFunction("pgq.get_batch_cursor", 3, sql_file = "pgq.upgrade.2to3.sql"), skytools.DBSchema("pgq_ext", sql_file="pgq_ext.sql"), # not needed actually skytools.DBSchema("pgq_node", sql_file="pgq_node.sql"), ] objs += self.extra_objs skytools.db_install(db.cursor(), objs, self.log) db.commit()