# Path: whyattend/model.py
# def init_db():
#     def __init__(self, wot_id, openid, member_since, name, clan, role, locked=False):
#     def is_recruit(self):
#     def battles_played(self):
#     def battles_reserve(self):
#     def __repr__(self):
#     def to_dict(self):
#     def player_role_value(self):
#     def __init__(self, player, battle, reserve=False):
#     def __init__(self, date, clan, enemy_clan, victory, draw, creator, battle_commander, map_name, map_province,
#                  duration, description='', paid=False):
#     def outcome_str(self):
#     def outcome_repr(self):
#     def has_player(self, player):
#     def has_reserve(self, player):
#     def get_players(self):
#     def get_reserve_players(self):
#     def __str__(self):
#     def __init__(self, title, description, clan, date):
#     def get_players(self):
#     def get_reserves(self):
#     def get_final_battle(self):
#     def get_representative_battle(self):
#     def __init__(self, replay_blob, replay_pickle):
#     def unpickle(self):
#     def get(cls):
# class Player(Base):
# class BattleAttendance(Base):
# class Battle(Base):
# class BattleGroup(Base):
# class Replay(Base):
# class WebappData(Base):


from alembic import op
from whyattend.model import Base, Battle, db_session
import sqlalchemy as sa
"""add battle duration

Revision ID: 3a763038a0c9
Revises: 18b90187fbae
Create Date: 2013-12-09 19:29:49.336000

"""

# revision identifiers, used by Alembic.
revision = '3a763038a0c9'
down_revision = '18b90187fbae'


Base.metadata.bind = op.get_bind()


def upgrade():
    op.add_column('battle', sa.Column('duration', sa.Integer, default=0, nullable=True))
    # Parse battle duration from existing replay pickles

# Path: whyattend/model.py
# def init_db():
#     def __init__(self, wot_id, openid, member_since, name, clan, role, locked=False):
#     def is_recruit(self):
#     def battles_played(self):
#     def battles_reserve(self):
#     def __repr__(self):
#     def to_dict(self):
#     def player_role_value(self):
#     def __init__(self, player, battle, reserve=False):
#     def __init__(self, date, clan, enemy_clan, victory, draw, creator, battle_commander, map_name, map_province,
#                  duration, description='', paid=False):
#     def outcome_str(self):
#     def outcome_repr(self):
#     def has_player(self, player):
#     def has_reserve(self, player):
#     def get_players(self):
#     def get_reserve_players(self):
#     def __str__(self):
#     def __init__(self, title, description, clan, date):
#     def get_players(self):
#     def get_reserves(self):
#     def get_final_battle(self):
#     def get_representative_battle(self):
#     def __init__(self, replay_blob, replay_pickle):
#     def unpickle(self):
#     def get(cls):
# class Player(Base):
# class BattleAttendance(Base):
# class Battle(Base):
# class BattleGroup(Base):
# class Replay(Base):
# class WebappData(Base):


# Path: whyattend/alembic/versions/3a763038a0c9_add_battle_duration.py
from alembic import op
from whyattend.model import Base, Battle, db_session
import sqlalchemy as sa

"""add battle duration

Revision ID: 3a763038a0c9
Revises: 18b90187fbae
Create Date: 2013-12-09 19:29:49.336000

"""

# revision identifiers, used by Alembic.
revision = '3a763038a0c9'
down_revision = '18b90187fbae'


Base.metadata.bind = op.get_bind()


def upgrade():
    op.add_column('battle', sa.Column('duration', sa.Integer, default=0, nullable=True))
    # Parse battle duration from existing replay pickles

    for battle in Battle.query.all():