00001
00002
00003 import sys
00004
00005 import Ganga.GPI
00006
00007 history = """
00008
00009 GBS Version Range Schema Versions Summary of Changes
00010 Current Earlist
00011
00012 V00-00-00 V01-07-01 0 0 A progression of changes to all objects
00013
00014 V01-08-00 current 1 0 GBSManager: Add schemaVersion
00015
00016 """
00017
00018 def migrate(manager):
00019
00020 """Migrate manager and all its dependents to the current schema version.
00021
00022 This module is responsible for migrating projects as the stored
00023 schema evolve. It does this simply by calling the manager's
00024 WriteFamily() method so that all the optional data members (those
00025 with '+' or '-' qualifiers in the call to ioh in _DoMemberIO(ioh)
00026 will synchronise with the current version. This will allow the
00027 eventual removal of these qualifiers."""
00028
00029 min_ver = 0
00030 cur_ver = 1
00031 man_ver = manager.GetSchemaVersion()
00032 if ( man_ver < min_ver ):
00033 print "\nSorry, Manager :-\n\n" + str(manager)
00034 print "\nhas a schema version that is too old to migrate to the current version " + str(cur_ver)
00035 print "PLease check the table below to find a version of GBS that can migrate your version on."
00036 print history
00037 sys.exit(1)
00038 if ( man_ver > cur_ver ):
00039 print "\nSomething is wrong! The current schema version is " + str(cur_ver)
00040 print "but the manager has a later version:-\n\n" + str(manager)
00041 print "\nHere is the recorded schema history:-"
00042 print history
00043 print "Please investigate!"
00044 sys.exit(1)
00045 if ( man_ver == cur_ver):
00046 print "The schema version (%d) is up to date" % cur_ver
00047 return
00048 print "\nMigrating data structure schema %d -> %d please wait ...." % (man_ver,cur_ver)
00049 manager.WriteFamily()
00050 print "Migration complete"
00051 manager._SetSchemaVersion(cur_ver)