From: Kevin C. <ke...@us...> - 2006-03-28 19:28:29
|
Update of /cvsroot/mailmanager/MailManager/migrations/v2_1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18021/migrations/v2_1 Modified Files: __init__.py Log Message: Merging in changes from 2.1 Index: __init__.py =================================================================== RCS file: /cvsroot/mailmanager/MailManager/migrations/v2_1/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- __init__.py 27 Mar 2006 12:54:34 -0000 1.2 +++ __init__.py 28 Mar 2006 19:28:16 -0000 1.3 @@ -19,11 +19,50 @@ # Update the mversion to show we are complete self.mversion = 'v2_1_1' +def migrate_v2_1_1_v2_1_2(self, migrationParams): + """ Move to multiple ruleset descriptions in the database + + The previous release only had a single ruleset, entitled queuesystem. + We now need to move to using multiple rulesets and migrate existing + tickets between rulesets. Normally end users are only going to have + a single ruleset in use, which should be the latest revision of + queuesystem. + + Multiple rulesets in the same system would require some fixes still. + The account table would need a rsname attribute, and the ruleset + engine would need to load the ruleset from a ticket each time. Also, + difficulties arise when dealing with supporters over multiple + rulesets. + """ + + schema = migrationParams.get('schema', '') + create_tables = migrationParams.get('create_tables', False) + dbplatform = migrationParams.get('dbplatform', 'postgres') + + self.sql.migrateRulesetStates() + + # Load in additional ruleset and update engine + self.engine.setup(rsname = 'queuesystem_2_1_1') + + # Convert any tickets + for id in [t.id for t in self.sql.listTickets(sqv_state = 'New')]: + self.sql.editTicket(sqv_id = id, sqv_state = 'Open') + for id in [t.id for t in self.sql.listTickets(sqv_rsname = 'queuesystem')]: + self.sql.editTicket(sqv_id = id, sqv_rsname = 'queuesystem_2_1_1') + + # Update the mversion to show we are complete + self.mversion = 'v2_1_2' + migrations = { 'v2_1_0' : { 'targetstate' : 'v2_1_1', 'overview' : 'Add on TID flag to accounts', 'method' : migrate_v2_1_0_v2_1_1, - } + }, + 'v2_1_1' : { + 'targetstate' : 'v2_1_2', + 'overview' : 'Move to multiple ruleset descriptions in the database', + 'method' : migrate_v2_1_1_v2_1_2, + }, } |