from playhouse.migrate import *
import app.db_engine as db_engine

migrator = SqliteMigrator(db_engine.db)


# pubdate_field = DateTimeField(null=True)
# comment_field = TextField(default='')


# pitcher_injury = IntegerField(null=True)
# pos_1 = CharField(default='None')
# pos_2 = CharField(null=True)
# hand_batting = CharField(null=True)
# hand_pitching = CharField(null=True)
# re24_primary = FloatField(null=True)
# re24_running = FloatField(null=True)
# last_game2 = CharField(null=True)
# division = ForeignKeyField(db_engine.Division, field=db_engine.Division.id, null=True)  # for division migration
# manager = ForeignKeyField(db_engine.Manager, field=db_engine.Manager.id, null=True)  # for manager table
# p_career = ForeignKeyField(db_engine.PitchingCareer, field=db_engine.PitchingCareer.id, null=True)  # for careers
# b_career = ForeignKeyField(db_engine.BattingCareer, field=db_engine.BattingCareer.id, null=True)  # for careers
# f_career = ForeignKeyField(db_engine.FieldingCareer, field=db_engine.FieldingCareer.id, null=True)  # for careers
away_manager = ForeignKeyField(db_engine.Manager, field=db_engine.Manager.id, null=True)  # to add Manager to games
home_manager = ForeignKeyField(db_engine.Manager, field=db_engine.Manager.id, null=True)  # to add Manager to games
team = ForeignKeyField(db_engine.Team, field=db_engine.Team.id, null=True)  # to add Team to decisions

migrate(
    # migrator.add_column('team', 'division_id', division),  # for division migration
    # migrator.add_column('team', 'manager1_id', manager),  # for manager table
    # migrator.add_column('team', 'manager2_id', manager),  # for manager table
    # migrator.add_column('battingseason', 'career_id', b_career),  # for career stats
    # migrator.add_column('pitchingseason', 'career_id', p_career),  # for career stats
    # migrator.add_column('fieldingseason', 'career_id', f_career),  # for career stats
    # migrator.add_column('player', 'last_game2', last_game2),
    # migrator.add_column('player', 'pos_1', pos_1),
    # migrator.add_column('comment_tbl', 'comment', comment_field),
    # migrator.rename_column('team', 'division', 'division_legacy'),
    # migrator.drop_column('story', 'some_old_field'),
    # migrator.drop_not_null('team', 'abbrev'),
    # migrator.add_not_null('story', 'modified_date'),
    # migrator.rename_table('story', 'stories_tbl'),
    # migrator.drop_index('team', 'team_abbrev'),
    # migrator.drop_index('player', 'player_name')
    migrator.add_column('decision', 'team', team),
    # migrator.add_column('stratplay', 'hand_batting', hand_batting),
    # migrator.add_column('stratplay', 'hand_pitching', hand_pitching),
    # migrator.add_column('stratplay', 're24_primary', re24_primary),
    # migrator.add_column('stratplay', 're24_running', re24_running)
)