Add pcsxr deprecation migration

This commit is contained in:
Mathieu Comandon 2017-05-14 18:00:36 -07:00
parent d8c0e38bd1
commit 03baefc04b
2 changed files with 22 additions and 1 deletions

View file

@ -2,7 +2,7 @@ import importlib
from lutris import settings
from lutris.util.log import logger
MIGRATION_VERSION = 3
MIGRATION_VERSION = 4
MIGRATIONS = []
@ -19,6 +19,10 @@ MIGRATIONS.append([
'update_runners',
])
MIGRATIONS.append([
'pcsxr_deprecation'
])
def get_migration_module(migration_name):
return importlib.import_module('lutris.migrations.%s' % migration_name)

View file

@ -0,0 +1,17 @@
from lutris.pga import sql, PGA_DB
from lutris.game import Game
def migrate():
pcsxr_game_ids = sql.db_query(PGA_DB, "select id from games where runner='pcsxr'")
for game_id in pcsxr_game_ids:
game = Game(game_id['id'])
main_file = game.config.raw_game_config.get('iso')
game.config.game_level = {
'game': {
'core': 'pcsx_rearmed',
'main_file': main_file
}
}
game.config.save()
sql.db_update(PGA_DB, 'games', {'runner': 'libretro'}, where=('runner', 'pcsxr'))