def upgrade_environment(self, db): db = self.env.get_db_cnx() needsCreate = True needsUpgrade_milestone = True needsUpgrade_burndown = False if dbhelper.table_exists(db, "burndown"): needsCreate = False if dbhelper.table_field_exists(db, "burndown", "week"): needsUpgrade_burndown = True if dbhelper.table_field_exists(db, "milestone", "started"): needsUpgrade_milestone = False if needsCreate: print >> sys.stderr, 'Attempting to create the burndown table' dbhelper.create_burndown_table(db, self.env) if needsUpgrade_milestone: print >> sys.stderr, 'Attempting to modify the milestone table' dbhelper.upgrade_milestone_table(db, self.env) if needsUpgrade_burndown: print >> sys.stderr, 'Attempting to modify the burndown table' dbhelper.upgrade_burndown_table(db, self.env) db.commit()
def environment_needs_upgrade(self, db): if not db: db = self.env.get_db_cnx() needsUpgrade = True # See if the burndown table exists, if not, we need an upgrade if dbhelper.table_exists(db, "burndown"): needsUpgrade = False if dbhelper.table_field_exists(db, "burndown", "week"): needsUpgrade = True if dbhelper.table_field_exists(db, "milestone", "started"): needsUpgrade = False return needsUpgrade