def upgrade(self, backup=False, backup_dest=None): """Upgrade database. @param backup: whether or not to backup before upgrading @param backup_dest: name of the backup file @return: whether the upgrade was performed """ upgraders = [] db = self.get_read_db() for participant in self.setup_participants: if participant.environment_needs_upgrade(db): upgraders.append(participant) if not upgraders: return if backup: self.backup(backup_dest) for participant in upgraders: self.log.info("%s.%s upgrading...", participant.__module__, participant.__class__.__name__) with_transaction(self)(participant.upgrade_environment) # Database schema may have changed, so close all connections DatabaseManager(self).shutdown() return True
def with_transaction(self, db=None): """Decorator for transaction functions. :deprecated: Use the query and transaction context managers instead. Will be removed in Trac 1.3.1. """ return with_transaction(self, db)
def with_transaction(self, db=None): """Decorator for transaction functions :deprecated:""" return with_transaction(self, db)
def with_transaction(self, db=None): """Decorator for transaction functions. See `trac.db.api.with_transaction` for detailed documentation.""" return with_transaction(self, db)