def populateMemberTables(sqlStore):
    """
    Set the group kind and and members tables
    """
    @inlineCallbacks
    def doIt(txn, homeResourceID):
        """
        KIND is set to person by schema upgrade.
        To upgrade MEMBERS and FOREIGN_MEMBERS:
            1. Set group KIND (avoids assert)
            2. Write groups.  Write logic will fill in MEMBERS and FOREIGN_MEMBERS
                (Remember that all members resource IDs must already be in the address book).
        """
        home = yield txn.addressbookHomeWithResourceID(homeResourceID)
        abObjectResources = yield home.addressbook().objectResources()
        for abObject in abObjectResources:
            component = yield abObject.component()
            lcResourceKind = component.resourceKind().lower() if component.resourceKind() else component.resourceKind()
            if lcResourceKind == "group":
                # update kind
                abo = schema.ADDRESSBOOK_OBJECT
                yield Update({abo.KIND: _ABO_KIND_GROUP},
                                Where=abo.RESOURCE_ID == abObject._resourceID,
                                ).on(txn)
                abObject._kind = _ABO_KIND_GROUP
                #update rest
                yield abObject.setComponent(component)

    logUpgradeStatus("Starting Addressbook Populate Members")

    # Do this to each calendar home not already at version 2
    yield doToEachHomeNotAtVersion(sqlStore, schema.ADDRESSBOOK_HOME, UPGRADE_TO_VERSION, doIt, "Populate Members")
def populateMemberTables(sqlStore):
    """
    Set the group kind and and members tables
    """
    @inlineCallbacks
    def doIt(txn, homeResourceID):
        """
        KIND is set to person by schema upgrade.
        To upgrade MEMBERS and FOREIGN_MEMBERS:
            1. Set group KIND (avoids assert)
            2. Write groups.  Write logic will fill in MEMBERS and FOREIGN_MEMBERS
                (Remember that all members resource IDs must already be in the address book).
        """
        home = yield txn.addressbookHomeWithResourceID(homeResourceID)
        abObjectResources = yield home.addressbook().objectResources()
        for abObject in abObjectResources:
            component = yield abObject.component()
            lcResourceKind = component.resourceKind().lower() if component.resourceKind() else component.resourceKind()
            if lcResourceKind == "group":
                # update kind
                abo = schema.ADDRESSBOOK_OBJECT
                yield Update(
                    {abo.KIND: _ABO_KIND_GROUP},
                    Where=abo.RESOURCE_ID == abObject._resourceID,
                ).on(txn)
                abObject._kind = _ABO_KIND_GROUP
                # update rest
                yield abObject.setComponent(component)

    logUpgradeStatus("Starting Addressbook Populate Members")

    # Do this to each calendar home not already at version 2
    yield doToEachHomeNotAtVersion(sqlStore, schema.ADDRESSBOOK_HOME, UPGRADE_TO_VERSION, doIt, "Populate Members")
Exemple #3
0
def updateCalendarHomes(sqlStore, prefix=None):
    """
    For each calendar home, update the associated properties on the home or its owned calendars.
    """

    yield doToEachHomeNotAtVersion(sqlStore,
                                   schema.CALENDAR_HOME,
                                   UPGRADE_TO_VERSION,
                                   updateCalendarHome,
                                   "Update Calendar Home",
                                   filterOwnerUID=prefix)
def splitCalendars(sqlStore):
    """
    Split all calendars by component type.
    """

    @inlineCallbacks
    def doIt(txn, homeResourceID):
        """
        Split each regular calendar in the home.
        """
        home = yield txn.calendarHomeWithResourceID(homeResourceID)
        yield home.splitCalendars()

    # Do this to each calendar home not already at version 2
    yield doToEachHomeNotAtVersion(sqlStore, schema.CALENDAR_HOME, UPGRADE_TO_VERSION, doIt)
Exemple #5
0
def splitCalendars(sqlStore):
    """
    Split all calendars by component type.
    """

    # This is already done when doing file->sql migration
    if sqlStore._migrating:
        returnValue(None)

    @inlineCallbacks
    def doIt(txn, homeResourceID):
        """
        Split each regular calendar in the home.
        """
        home = yield txn.calendarHomeWithResourceID(homeResourceID)
        yield home.splitCalendars()

    logUpgradeStatus("Starting Split Calendars")

    # Do this to each calendar home not already at version 2
    yield doToEachHomeNotAtVersion(sqlStore, schema.CALENDAR_HOME, UPGRADE_TO_VERSION, doIt, "Split Calendars")
def splitCalendars(sqlStore):
    """
    Split all calendars by component type.
    """

    # This is already done when doing file->sql migration
    if sqlStore._migrating:
        returnValue(None)


    @inlineCallbacks
    def doIt(txn, homeResourceID):
        """
        Split each regular calendar in the home.
        """
        home = yield txn.calendarHomeWithResourceID(homeResourceID)
        yield home.splitCalendars()

    logUpgradeStatus("Starting Split Calendars")

    # Do this to each calendar home not already at version 2
    yield doToEachHomeNotAtVersion(sqlStore, schema.CALENDAR_HOME, UPGRADE_TO_VERSION, doIt, "Split Calendars")
def updateNotificationHomes(sqlStore, prefix=None):
    """
    For each calendar home, update the associated properties on the home or its owned calendars.
    """

    yield doToEachHomeNotAtVersion(sqlStore, schema.NOTIFICATION_HOME, UPGRADE_TO_VERSION, updateNotificationHome, "Update Notification Home", filterOwnerUID=prefix)