def remove_old_versions(db):
 start = ('%s.%s.0' % (major, minor))
 migrate_features = 1
 if snapshot:
  add_data(db, 'Upgrade', [(upgrade_code_snapshot, start, current_version, None, migrate_features, None, 'REMOVEOLDSNAPSHOT')])
  props = 'REMOVEOLDSNAPSHOT'
 else:
  add_data(db, 'Upgrade', [(upgrade_code, start, current_version, None, migrate_features, None, 'REMOVEOLDVERSION'), (upgrade_code_snapshot, start, ('%s.%d.0' % (major, (int(minor) + 1))), None, migrate_features, None, 'REMOVEOLDSNAPSHOT')])
  props = 'REMOVEOLDSNAPSHOT;REMOVEOLDVERSION'
 props += ';TARGETDIR;DLLDIR;LAUNCHERDIR'
 add_data(db, 'Property', [('SecureCustomProperties', props)])

def remove_old_versions ( db ) : start = ( '%s.%s.0' % ( major , minor ) ) migrate_features = 1 if snapshot : add_data ( db , 'Upgrade' , [ ( upgrade_code_snapshot , start , current_version , None , migrate_features , None , 'REMOVEOLDSNAPSHOT' ) ] ) props = 'REMOVEOLDSNAPSHOT' else : add_data ( db , 'Upgrade' , [ ( upgrade_code , start , current_version , None , migrate_features , None , 'REMOVEOLDVERSION' ) , ( upgrade_code_snapshot , start , ( '%s.%d.0' % ( major , ( int ( minor ) + 1 ) ) ) , None , migrate_features , None , 'REMOVEOLDSNAPSHOT' ) ] ) props = 'REMOVEOLDSNAPSHOT;REMOVEOLDVERSION' props += ';TARGETDIR;DLLDIR;LAUNCHERDIR' add_data ( db , 'Property' , [ ( 'SecureCustomProperties' , props ) ] )
fill the upgrade table .