GAMES = {
    'Xrd': 'Guilty Gear Xrd REV2',
    'UNIST': 'Under Night In-Birth: Exe Late[ST]',
    'MBAACC': 'Melty Blood Actress Again Current Code',
    'BBCF': 'Blazblue Central Fiction'
}


def populate_games(apps, schema_editor):
    """ A helper function to be used in migrations which load games
    into the Game table.
    """
    Game = apps.get_model('matchmaking', 'Game')
    for key, value in GAMES.items():
        game_object = Game.objects.filter(shortcode=key)
        if not game_object:
            game = Game.objects.create(shortcode=key, name=value)
            game.save()