Revision: 9276 http://trac.macosforge.org/projects/calendarserver/changeset/9276 Author: glyph@apple.com Date: 2012-05-24 13:33:41 -0700 (Thu, 24 May 2012) Log Message: ----------- schema upgrader for proxy database to normalize possibly-UUID portions of the data Modified Paths: -------------- CalendarServer/branches/users/glyph/uuid-normalize/twistedcaldav/directory/calendaruserproxy.py Modified: CalendarServer/branches/users/glyph/uuid-normalize/twistedcaldav/directory/calendaruserproxy.py =================================================================== --- CalendarServer/branches/users/glyph/uuid-normalize/twistedcaldav/directory/calendaruserproxy.py 2012-05-24 20:33:38 UTC (rev 9275) +++ CalendarServer/branches/users/glyph/uuid-normalize/twistedcaldav/directory/calendaruserproxy.py 2012-05-24 20:33:41 UTC (rev 9276) @@ -47,6 +47,7 @@ from twistedcaldav.directory.principal import formatLinks from twistedcaldav.directory.principal import formatPrincipals +from twistedcaldav.directory.util import normalizeUUID from twistedcaldav.config import config, fullServerPath from twistedcaldav.database import AbstractADBAPIDatabase, ADBAPISqliteMixin,\ ADBAPIPostgreSQLMixin @@ -415,11 +416,11 @@ """ - schema_version = "4" + schema_version = "5" schema_type = "CALENDARUSERPROXY" - + class ProxyDBMemcacher(Memcacher): - + def __init__(self, namespace): super(ProxyDB.ProxyDBMemcacher, self).__init__(namespace, key_normalization=config.Memcached.ProxyDBKeyNormalization) @@ -774,6 +775,7 @@ ifnotexists=True, ) + @inlineCallbacks def _db_upgrade_data_tables(self, old_version): """ @@ -797,6 +799,18 @@ ifnotexists=True, ) + if int(old_version) < 5: + for groupname, member in ( + (yield self.query("select GROUPNAME, MEMBER from GROUPS")) + ): + groupPrincipalUID, groupMode = groupname.split("#") + yield self._db_execute(""" + update GROUPS set (GROUPNAME = :1, MEMBER = :2) + where GROUPNAME = :1 and MEMBER = :2 + """, "#".join([normalizeUUID(groupPrincipalUID), groupMode]), + normalizeUUID(member)) + + def _db_empty_data_tables(self): """ Empty the underlying database tables.
participants (1)
-
source_changes@macosforge.org