示例#1
0
    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
示例#2
0
    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
示例#3
0
    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)
示例#4
0
文件: env.py 项目: pkdevbox/trac
    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)
示例#5
0
 def with_transaction(self, db=None):
     """Decorator for transaction functions :deprecated:"""
     return with_transaction(self, db)
示例#6
0
 def with_transaction(self, db=None):
     """Decorator for transaction functions :deprecated:"""
     return with_transaction(self, db)
示例#7
0
    def with_transaction(self, db=None):
        """Decorator for transaction functions.

        See `trac.db.api.with_transaction` for detailed documentation."""
        return with_transaction(self, db)
示例#8
0
    def with_transaction(self, db=None):
        """Decorator for transaction functions.

        See `trac.db.api.with_transaction` for detailed documentation."""
        return with_transaction(self, db)