def apply(self):
        """
        Applies all migrations that have been added.
        Note that some migrations depend on others, so you might end up
        running more than one.
        """
        if self.__closed:
            raise MigrationSessionError("Can't apply applied session")
        try:
            while self._to_apply:
                self.__apply(migration=self._to_apply.pop(0))
        except:
            raise
        finally:
            self.__closed = True