"""sao_backport

Revision ID: a616fd164e40
Revises: 48f4acc43a7e
Create Date: 2024-06-24 20:28:34.471282

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = 'a616fd164e40'
down_revision = '48f4acc43a7e'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('sao_static_quest', sa.Column('QuestSceneId', sa.BIGINT(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('SortNo', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('Tutorial', sa.BOOLEAN(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('ColRate', sa.DECIMAL(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('LimitDefault', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('LimitResurrection', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('RewardTableSubId', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('PlayerTraceTableSubId', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('SuccessPlayerExp', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('FailedPlayerExp', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('PairExpRate', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('TrioExpRate', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('SingleRewardVp', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('PairRewardVp', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_quest', sa.Column('TrioRewardVp', sa.INTEGER(), nullable=False))
    op.drop_index('sao_static_quest_uk', table_name='sao_static_quest')
    op.drop_column('sao_static_quest', 'id')
    op.drop_column('sao_static_quest', 'enabled')
    op.drop_column('sao_static_quest', 'version')
    op.drop_column('sao_static_quest', 'questSceneId')
    op.drop_column('sao_static_quest', 'sortNo')
    op.drop_column('sao_static_quest', 'name')
    op.create_table('sao_static_property',
    sa.Column('PropertyId', sa.BIGINT(), nullable=False),
    sa.Column('PropertyTargetType', sa.INTEGER(), nullable=False),
    sa.Column('PropertyName', sa.VARCHAR(length=255), nullable=False),
    sa.Column('PropertyName_en', sa.VARCHAR(length=255), nullable=True),
    sa.Column('PropertyNameFormat', sa.VARCHAR(length=255), nullable=False),
    sa.Column('PropertyNameFormat_en', sa.VARCHAR(length=255), nullable=True),
    sa.Column('PropertyTypeId', sa.INTEGER(), nullable=False),
    sa.Column('Value1Min', sa.INTEGER(), nullable=False),
    sa.Column('Value1Max', sa.INTEGER(), nullable=False),
    sa.Column('Value2Min', sa.INTEGER(), nullable=False),
    sa.Column('Value2Max', sa.INTEGER(), nullable=False),
    sa.PrimaryKeyConstraint('PropertyId'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_static_reward',
    sa.Column('RewardTableId', sa.BIGINT(), nullable=False),
    sa.Column('RewardTableSubId', sa.INTEGER(), nullable=False),
    sa.Column('UnanalyzedLogGradeId', sa.INTEGER(), nullable=False),
    sa.Column('CommonRewardType', sa.INTEGER(), nullable=False),
    sa.Column('CommonRewardId', sa.INTEGER(), nullable=False),
    sa.Column('CommonRewardNum', sa.INTEGER(), nullable=False),
    sa.Column('StrengthMin', sa.INTEGER(), nullable=False),
    sa.Column('StrengthMax', sa.INTEGER(), nullable=False),
    sa.Column('PropertyTableSubId', sa.INTEGER(), nullable=False),
    sa.Column('QuestInfoDisplayFlag', sa.BOOLEAN(), nullable=False),
    sa.Column('Rate', sa.INTEGER(), nullable=False),
    sa.PrimaryKeyConstraint('RewardTableId'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_static_skill',
    sa.Column('SkillId', sa.BIGINT(), nullable=False),
    sa.Column('WeaponTypeId', sa.INTEGER(), nullable=False),
    sa.Column('Name', sa.VARCHAR(length=255), nullable=False),
    sa.Column('Name_en', sa.VARCHAR(length=255), nullable=True),
    sa.Column('Attack', sa.BOOLEAN(), nullable=False),
    sa.Column('Passive', sa.BOOLEAN(), nullable=False),
    sa.Column('Pet', sa.BOOLEAN(), nullable=False),
    sa.Column('Level', sa.INTEGER(), nullable=False),
    sa.Column('SkillCondition', sa.INTEGER(), nullable=False),
    sa.Column('CoolTime', sa.INTEGER(), nullable=False),
    sa.Column('SkillIcon', sa.VARCHAR(length=255), nullable=False),
    sa.Column('FriendSkillIcon', sa.VARCHAR(length=255), nullable=False),
    sa.Column('InfoText', sa.VARCHAR(length=255), nullable=False),
    sa.Column('InfoText_en', sa.VARCHAR(length=255), nullable=True),
    sa.PrimaryKeyConstraint('SkillId'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_static_trace_table',
    sa.Column('PlayerTraceTableId', sa.BIGINT(), nullable=False),
    sa.Column('PlayerTraceTableSubId', sa.INTEGER(), nullable=False),
    sa.Column('CommonRewardType', sa.INTEGER(), nullable=False),
    sa.Column('CommonRewardId', sa.INTEGER(), nullable=False),
    sa.Column('CommonRewardNum', sa.INTEGER(), nullable=False),
    sa.Column('Rate', sa.INTEGER(), nullable=False),
    sa.PrimaryKeyConstraint('PlayerTraceTableId'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_player_beginner_mission',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('user', sa.INTEGER(), nullable=False),
    sa.Column('beginner_mission_id', sa.INTEGER(), nullable=False),
    sa.Column('condition_id', sa.INTEGER(), nullable=False),
    sa.Column('is_seat', sa.BOOLEAN(), server_default='0', nullable=False),
    sa.Column('achievement_num', sa.INTEGER(), nullable=False),
    sa.Column('complete_flag', sa.BOOLEAN(), server_default='0', nullable=False),
    sa.Column('complete_date', sa.TIMESTAMP(), nullable=True),
    sa.Column('reward_received_flag', sa.BOOLEAN(), server_default='0', nullable=False),
    sa.Column('reward_received_date', sa.TIMESTAMP(), nullable=True),
    sa.ForeignKeyConstraint(['user'], ['aime_user.id'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('user'),
    sa.UniqueConstraint('user', 'condition_id', name='sao_player_beginner_mission_uk'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_player_resource_card',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('user', sa.INTEGER(), nullable=False),
    sa.Column('common_reward_type', sa.INTEGER(), nullable=False),
    sa.Column('common_reward_id', sa.INTEGER(), nullable=False),
    sa.Column('holographic_flag', sa.BOOLEAN(), server_default='0', nullable=False),
    sa.Column('serial', sa.VARCHAR(length=20), nullable=True),
    sa.ForeignKeyConstraint(['user'], ['aime_user.id'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('serial'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_player_tutorial',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('user', sa.INTEGER(), nullable=False),
    sa.Column('tutorial_byte', sa.INTEGER(), nullable=False),
    sa.ForeignKeyConstraint(['user'], ['aime_user.id'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('user', 'tutorial_byte', name='sao_player_tutorial_uk'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_static_episode',
    sa.Column('EpisodeId', sa.BIGINT(), nullable=False),
    sa.Column('EpisodeChapterId', sa.INTEGER(), nullable=False),
    sa.Column('ReleaseEpisodeId', sa.INTEGER(), nullable=False),
    sa.Column('Title', sa.VARCHAR(length=255), nullable=False),
    sa.Column('CommentSummary', sa.VARCHAR(length=255), nullable=False),
    sa.Column('ExBonusTableSubId', sa.INTEGER(), nullable=False),
    sa.Column('QuestSceneId', sa.BIGINT(), nullable=True),
    sa.ForeignKeyConstraint(['QuestSceneId'], ['sao_static_quest.QuestSceneId'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('EpisodeId'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_static_ex_bonus',
    sa.Column('ExBonusTableId', sa.BIGINT(), nullable=False),
    sa.Column('ExBonusTableSubId', sa.INTEGER(), nullable=False),
    sa.Column('ExBonusConditionId', sa.INTEGER(), nullable=False),
    sa.Column('ConditionValue1', sa.INTEGER(), nullable=False),
    sa.Column('ConditionValue2', sa.INTEGER(), nullable=False),
    sa.Column('CommonRewardType', sa.INTEGER(), nullable=False),
    sa.Column('CommonRewardId', sa.INTEGER(), nullable=False),
    sa.Column('CommonRewardNum', sa.INTEGER(), nullable=False),
    sa.Column('Strength', sa.INTEGER(), nullable=False),
    sa.Column('Property1PropertyId', sa.BIGINT(), nullable=False),
    sa.Column('Property1Value1', sa.INTEGER(), nullable=False),
    sa.Column('Property1Value2', sa.INTEGER(), nullable=False),
    sa.Column('Property2PropertyId', sa.BIGINT(), nullable=False),
    sa.Column('Property2Value1', sa.INTEGER(), nullable=False),
    sa.Column('Property2Value2', sa.INTEGER(), nullable=False),
    sa.Column('Property3PropertyId', sa.BIGINT(), nullable=False),
    sa.Column('Property3Value1', sa.INTEGER(), nullable=False),
    sa.Column('Property3Value2', sa.INTEGER(), nullable=False),
    sa.Column('Property4PropertyId', sa.BIGINT(), nullable=False),
    sa.Column('Property4Value1', sa.INTEGER(), nullable=False),
    sa.Column('Property4Value2', sa.INTEGER(), nullable=False),
    sa.ForeignKeyConstraint(['Property1PropertyId'], ['sao_static_property.PropertyId'], onupdate='cascade', ondelete='cascade'),
    sa.ForeignKeyConstraint(['Property2PropertyId'], ['sao_static_property.PropertyId'], onupdate='cascade', ondelete='cascade'),
    sa.ForeignKeyConstraint(['Property3PropertyId'], ['sao_static_property.PropertyId'], onupdate='cascade', ondelete='cascade'),
    sa.ForeignKeyConstraint(['Property4PropertyId'], ['sao_static_property.PropertyId'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('ExBonusTableId'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_static_ex_tower',
    sa.Column('ExTowerQuestId', sa.BIGINT(), nullable=False),
    sa.Column('ExTowerId', sa.INTEGER(), nullable=False),
    sa.Column('ReleaseExTowerQuestId', sa.INTEGER(), nullable=False),
    sa.Column('Title', sa.VARCHAR(length=255), nullable=False),
    sa.Column('Title_en', sa.VARCHAR(length=255), nullable=True),
    sa.Column('ExBonusTableSubId', sa.INTEGER(), nullable=False),
    sa.Column('QuestSceneId', sa.BIGINT(), nullable=False),
    sa.ForeignKeyConstraint(['QuestSceneId'], ['sao_static_quest.QuestSceneId'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('ExTowerQuestId'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_static_side_quest',
    sa.Column('SideQuestId', sa.BIGINT(), nullable=False),
    sa.Column('DisplayName', sa.VARCHAR(length=255), nullable=False),
    sa.Column('DisplayName_en', sa.VARCHAR(length=255), nullable=True),
    sa.Column('EpisodeNum', sa.INTEGER(), nullable=False),
    sa.Column('ExBonusTableSubId', sa.INTEGER(), nullable=False),
    sa.Column('QuestSceneId', sa.BIGINT(), nullable=False),
    sa.ForeignKeyConstraint(['QuestSceneId'], ['sao_static_quest.QuestSceneId'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('SideQuestId'),
    sa.UniqueConstraint('SideQuestId'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_static_skill_table',
    sa.Column('SkillTableId', sa.BIGINT(), nullable=False),
    sa.Column('SkillId', sa.BIGINT(), nullable=False),
    sa.Column('SkillTableSubId', sa.INTEGER(), nullable=False),
    sa.Column('LevelObtained', sa.INTEGER(), nullable=False),
    sa.Column('AwakeningId', sa.INTEGER(), nullable=False),
    sa.ForeignKeyConstraint(['SkillId'], ['sao_static_skill.SkillId'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('SkillTableId'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_static_tower',
    sa.Column('TowerId', sa.BIGINT(), nullable=False),
    sa.Column('ReleaseTowerId', sa.INTEGER(), nullable=False),
    sa.Column('ExBonusTableSubId', sa.INTEGER(), nullable=False),
    sa.Column('QuestSceneId', sa.BIGINT(), nullable=False),
    sa.ForeignKeyConstraint(['QuestSceneId'], ['sao_static_quest.QuestSceneId'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('TowerId'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_player_ex_bonus',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('user', sa.INTEGER(), nullable=False),
    sa.Column('quest_scene_id', sa.BIGINT(), nullable=False),
    sa.Column('ex_bonus_table_id', sa.BIGINT(), nullable=False),
    sa.Column('quest_clear_flag', sa.BOOLEAN(), server_default='0', nullable=False),
    sa.ForeignKeyConstraint(['ex_bonus_table_id'], ['sao_static_ex_bonus.ExBonusTableId'], onupdate='cascade', ondelete='cascade'),
    sa.ForeignKeyConstraint(['quest_scene_id'], ['sao_static_quest.QuestSceneId'], onupdate='cascade', ondelete='cascade'),
    sa.ForeignKeyConstraint(['user'], ['aime_user.id'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('user', 'quest_scene_id', 'ex_bonus_table_id', name='sao_player_ex_bonus_uk'),
    mysql_charset='utf8mb4'
    )
    op.create_table('sao_player_hero_card',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('user', sa.INTEGER(), nullable=False),
    sa.Column('user_hero_id', sa.INTEGER(), nullable=False),
    sa.Column('holographic_flag', sa.BOOLEAN(), server_default='0', nullable=False),
    sa.Column('serial', sa.VARCHAR(length=20), nullable=True),
    sa.ForeignKeyConstraint(['user'], ['aime_user.id'], onupdate='cascade', ondelete='cascade'),
    sa.ForeignKeyConstraint(['user_hero_id'], ['sao_hero_log_data.id'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('serial'),
    mysql_charset='utf8mb4'
    )
    op.alter_column('sao_end_sessions', 'play_date',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('now()'),
               existing_nullable=False)
    op.add_column('sao_equipment_data', sa.Column('is_shop_purchase', sa.BOOLEAN(), server_default='0', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('is_protect', sa.BOOLEAN(), server_default='0', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('property1_property_id', sa.BIGINT(), server_default='2', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('property1_value1', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('property1_value2', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('property2_property_id', sa.BIGINT(), server_default='2', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('property2_value1', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('property2_value2', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('property3_property_id', sa.BIGINT(), server_default='2', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('property3_value1', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('property3_value2', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('property4_property_id', sa.BIGINT(), server_default='2', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('property4_value1', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('property4_value2', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_equipment_data', sa.Column('converted_card_num', sa.INTEGER(), server_default='0', nullable=False))
    op.alter_column('sao_equipment_data', 'equipment_id',
               existing_type=mysql.INTEGER(),
               type_=sa.BIGINT(),
               existing_nullable=False)
    op.alter_column('sao_equipment_data', 'get_date',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('now()'),
               existing_nullable=False)
    op.create_foreign_key(None, 'sao_equipment_data', 'sao_static_property', ['property2_property_id'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_equipment_data', 'sao_static_property', ['property4_property_id'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_equipment_data', 'sao_static_property', ['property3_property_id'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_equipment_data', 'sao_static_property', ['property1_property_id'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_equipment_data', 'sao_static_equipment_list', ['equipment_id'], ['EquipmentId'], onupdate='cascade', ondelete='cascade')
    op.add_column('sao_hero_log_data', sa.Column('hero_log_id', sa.BIGINT(), nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('max_level_extend_num', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('is_awakenable', sa.BOOLEAN(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('awakening_stage', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('awakening_exp', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('is_shop_purchase', sa.BOOLEAN(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('is_protect', sa.BOOLEAN(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('property1_property_id', sa.BIGINT(), server_default='2', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('property1_value1', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('property1_value2', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('property2_property_id', sa.BIGINT(), server_default='2', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('property2_value1', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('property2_value2', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('property3_property_id', sa.BIGINT(), server_default='2', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('property3_value1', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('property3_value2', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('property4_property_id', sa.BIGINT(), server_default='2', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('property4_value1', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('property4_value2', sa.INTEGER(), server_default='0', nullable=False))
    op.add_column('sao_hero_log_data', sa.Column('converted_card_num', sa.INTEGER(), server_default='0', nullable=False))
    op.alter_column('sao_hero_log_data', 'main_weapon',
               existing_type=mysql.INTEGER(),
               type_=sa.BIGINT(),
               nullable=True)
    op.alter_column('sao_hero_log_data', 'sub_equipment',
               existing_type=mysql.INTEGER(),
               type_=sa.BIGINT(),
               nullable=True)
    op.alter_column('sao_hero_log_data', 'skill_slot1_skill_id',
               existing_type=mysql.INTEGER(),
               type_=sa.BIGINT(),
               nullable=True)
    op.alter_column('sao_hero_log_data', 'skill_slot2_skill_id',
               existing_type=mysql.INTEGER(),
               type_=sa.BIGINT(),
               nullable=True)
    op.alter_column('sao_hero_log_data', 'skill_slot3_skill_id',
               existing_type=mysql.INTEGER(),
               type_=sa.BIGINT(),
               nullable=True)
    op.alter_column('sao_hero_log_data', 'skill_slot4_skill_id',
               existing_type=mysql.INTEGER(),
               type_=sa.BIGINT(),
               nullable=True)
    op.alter_column('sao_hero_log_data', 'skill_slot5_skill_id',
               existing_type=mysql.INTEGER(),
               type_=sa.BIGINT(),
               nullable=True)
    op.alter_column('sao_hero_log_data', 'get_date',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('now()'),
               existing_nullable=False)
    op.drop_constraint('sao_hero_log_data_uk', 'sao_hero_log_data', type_='unique')
    op.create_unique_constraint('sao_hero_log_data_uk', 'sao_hero_log_data', ['user', 'hero_log_id'])
    op.create_foreign_key(None, 'sao_hero_log_data', 'sao_static_property', ['property4_property_id'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_hero_log_data', 'sao_static_skill', ['skill_slot1_skill_id'], ['SkillId'], onupdate='set null', ondelete='set null')
    op.create_foreign_key(None, 'sao_hero_log_data', 'sao_static_skill', ['skill_slot5_skill_id'], ['SkillId'], onupdate='set null', ondelete='set null')
    op.create_foreign_key(None, 'sao_hero_log_data', 'sao_static_skill', ['skill_slot2_skill_id'], ['SkillId'], onupdate='set null', ondelete='set null')
    op.create_foreign_key(None, 'sao_hero_log_data', 'sao_static_skill', ['skill_slot3_skill_id'], ['SkillId'], onupdate='set null', ondelete='set null')
    op.create_foreign_key(None, 'sao_hero_log_data', 'sao_equipment_data', ['main_weapon'], ['id'], onupdate='set null', ondelete='set null')
    op.create_foreign_key(None, 'sao_hero_log_data', 'sao_static_property', ['property3_property_id'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_hero_log_data', 'sao_static_skill', ['skill_slot4_skill_id'], ['SkillId'], onupdate='set null', ondelete='set null')
    op.create_foreign_key(None, 'sao_hero_log_data', 'sao_equipment_data', ['sub_equipment'], ['id'], onupdate='set null', ondelete='set null')
    op.create_foreign_key(None, 'sao_hero_log_data', 'sao_static_property', ['property1_property_id'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_hero_log_data', 'sao_static_hero_list', ['hero_log_id'], ['HeroLogId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_hero_log_data', 'sao_static_property', ['property2_property_id'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.drop_column('sao_hero_log_data', 'user_hero_log_id')
    op.create_foreign_key(None, 'sao_hero_party', 'sao_hero_log_data', ['user_hero_log_id_3'], ['id'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_hero_party', 'sao_hero_log_data', ['user_hero_log_id_1'], ['id'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_hero_party', 'sao_hero_log_data', ['user_hero_log_id_2'], ['id'], onupdate='cascade', ondelete='cascade')
    op.alter_column('sao_item_data', 'get_date',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('now()'),
               existing_nullable=False)
    op.alter_column('sao_play_sessions', 'play_date',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('now()'),
               existing_nullable=False)
    op.add_column('sao_player_quest', sa.Column('quest_type', sa.INTEGER(), server_default='1', nullable=False))
    op.add_column('sao_player_quest', sa.Column('quest_scene_id', sa.BIGINT(), nullable=False))
    op.alter_column('sao_player_quest', 'play_date',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('now()'),
               existing_nullable=False)
    op.drop_constraint('sao_player_quest_uk', 'sao_player_quest', type_='unique')
    op.create_unique_constraint('sao_player_quest_uk', 'sao_player_quest', ['user', 'quest_scene_id'])
    op.create_foreign_key(None, 'sao_player_quest', 'sao_static_quest', ['quest_scene_id'], ['QuestSceneId'], onupdate='cascade', ondelete='cascade')
    op.drop_column('sao_player_quest', 'episode_id')
    op.add_column('sao_profile', sa.Column('my_shop', sa.INTEGER(), nullable=True))
    op.add_column('sao_profile', sa.Column('fav_hero', sa.INTEGER(), nullable=True))
    op.add_column('sao_profile', sa.Column('when_register', sa.TIMESTAMP(), server_default=sa.text('now()'), nullable=True))
    op.add_column('sao_profile', sa.Column('last_login_date', sa.TIMESTAMP(), nullable=True))
    op.add_column('sao_profile', sa.Column('last_yui_medal_date', sa.TIMESTAMP(), nullable=True))
    op.add_column('sao_profile', sa.Column('last_bonus_yui_medal_date', sa.TIMESTAMP(), nullable=True))
    op.add_column('sao_profile', sa.Column('last_comeback_date', sa.TIMESTAMP(), nullable=True))
    op.add_column('sao_profile', sa.Column('last_login_bonus_date', sa.TIMESTAMP(), nullable=True))
    op.add_column('sao_profile', sa.Column('ad_confirm_date', sa.TIMESTAMP(), nullable=True))
    op.add_column('sao_profile', sa.Column('login_ct', sa.INTEGER(), server_default='0', nullable=True))
    op.create_foreign_key(None, 'sao_profile', 'sao_hero_log_data', ['fav_hero'], ['id'], onupdate='cascade', ondelete='set null')
    op.add_column('sao_static_equipment_list', sa.Column('EquipmentId', sa.BIGINT(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('EquipmentType', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('WeaponTypeId', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Name', sa.VARCHAR(length=255), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Name_en', sa.VARCHAR(length=255), nullable=True))
    op.add_column('sao_static_equipment_list', sa.Column('Rarity', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Power', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('StrengthIncrement', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('SkillCondition', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Property1PropertyId', sa.BIGINT(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Property1Value1', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Property1Value2', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Property2PropertyId', sa.BIGINT(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Property2Value1', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Property2Value2', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Property3PropertyId', sa.BIGINT(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Property3Value1', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Property3Value2', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Property4PropertyId', sa.BIGINT(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Property4Value1', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('Property4Value2', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('SalePrice', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('CompositionExp', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('AwakeningExp', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('FlavorText', sa.VARCHAR(length=255), nullable=False))
    op.add_column('sao_static_equipment_list', sa.Column('FlavorText_en', sa.VARCHAR(length=255), nullable=True))
    op.drop_index('sao_static_equipment_list_uk', table_name='sao_static_equipment_list')
    op.create_foreign_key(None, 'sao_static_equipment_list', 'sao_static_property', ['Property2PropertyId'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_static_equipment_list', 'sao_static_property', ['Property1PropertyId'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_static_equipment_list', 'sao_static_property', ['Property3PropertyId'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_static_equipment_list', 'sao_static_property', ['Property4PropertyId'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.drop_column('sao_static_equipment_list', 'id')
    op.drop_column('sao_static_equipment_list', 'enabled')
    op.drop_column('sao_static_equipment_list', 'version')
    op.drop_column('sao_static_equipment_list', 'flavorText')
    op.drop_column('sao_static_equipment_list', 'equipmentType')
    op.drop_column('sao_static_equipment_list', 'equipmentId')
    op.drop_column('sao_static_equipment_list', 'rarity')
    op.drop_column('sao_static_equipment_list', 'name')
    op.drop_column('sao_static_equipment_list', 'weaponTypeId')
    op.add_column('sao_static_hero_list', sa.Column('HeroLogId', sa.BIGINT(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('CharaId', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Name', sa.VARCHAR(length=255), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Nickname', sa.VARCHAR(length=255), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Name_en', sa.VARCHAR(length=255), nullable=True))
    op.add_column('sao_static_hero_list', sa.Column('Nickname_en', sa.VARCHAR(length=255), nullable=True))
    op.add_column('sao_static_hero_list', sa.Column('Rarity', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('WeaponTypeId', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('HeroLogRoleId', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('CostumeTypeId', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('UnitId', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('DefaultEquipmentId1', sa.BIGINT(), nullable=True))
    op.add_column('sao_static_hero_list', sa.Column('DefaultEquipmentId2', sa.BIGINT(), nullable=True))
    op.add_column('sao_static_hero_list', sa.Column('SkillTableSubId', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('HpMin', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('HpMax', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('StrMin', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('StrMax', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('VitMin', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('VitMax', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('IntMin', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('IntMax', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Property1PropertyId', sa.BIGINT(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Property1Value1', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Property1Value2', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Property2PropertyId', sa.BIGINT(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Property2Value1', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Property2Value2', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Property3PropertyId', sa.BIGINT(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Property3Value1', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Property3Value2', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Property4PropertyId', sa.BIGINT(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Property4Value1', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Property4Value2', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('FlavorText', sa.VARCHAR(length=255), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('FlavorText_en', sa.VARCHAR(length=255), nullable=True))
    op.add_column('sao_static_hero_list', sa.Column('SalePrice', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('CompositionExp', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('AwakeningExp', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Slot4UnlockLevel', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('Slot5UnlockLevel', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('CollectionEmptyFrameDisplayFlag', sa.BOOLEAN(), nullable=False))
    op.drop_index('sao_static_hero_list_uk', table_name='sao_static_hero_list')
    op.create_foreign_key(None, 'sao_static_hero_list', 'sao_static_equipment_list', ['DefaultEquipmentId1'], ['EquipmentId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_static_hero_list', 'sao_static_property', ['Property3PropertyId'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_static_hero_list', 'sao_static_equipment_list', ['DefaultEquipmentId2'], ['EquipmentId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_static_hero_list', 'sao_static_property', ['Property1PropertyId'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_static_hero_list', 'sao_static_property', ['Property2PropertyId'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.create_foreign_key(None, 'sao_static_hero_list', 'sao_static_property', ['Property4PropertyId'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.drop_column('sao_static_hero_list', 'awakeningExp')
    op.drop_column('sao_static_hero_list', 'id')
    op.drop_column('sao_static_hero_list', 'nickname')
    op.drop_column('sao_static_hero_list', 'enabled')
    op.drop_column('sao_static_hero_list', 'version')
    op.drop_column('sao_static_hero_list', 'flavorText')
    op.drop_column('sao_static_hero_list', 'heroLogId')
    op.drop_column('sao_static_hero_list', 'skillTableSubId')
    op.drop_column('sao_static_hero_list', 'rarity')
    op.drop_column('sao_static_hero_list', 'name')
    op.add_column('sao_static_item_list', sa.Column('ItemId', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_item_list', sa.Column('ItemTypeId', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_item_list', sa.Column('Name', sa.VARCHAR(length=255), nullable=False))
    op.add_column('sao_static_item_list', sa.Column('Name_en', sa.VARCHAR(length=255), nullable=True))
    op.add_column('sao_static_item_list', sa.Column('Rarity', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_item_list', sa.Column('Value', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_item_list', sa.Column('PropertyId', sa.BIGINT(), nullable=False))
    op.add_column('sao_static_item_list', sa.Column('PropertyValue1Min', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_item_list', sa.Column('PropertyValue1Max', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_item_list', sa.Column('PropertyValue2Min', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_item_list', sa.Column('PropertyValue2Max', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_item_list', sa.Column('FlavorText', sa.VARCHAR(length=255), nullable=False))
    op.add_column('sao_static_item_list', sa.Column('FlavorText_en', sa.VARCHAR(length=255), nullable=True))
    op.add_column('sao_static_item_list', sa.Column('SalePrice', sa.INTEGER(), nullable=False))
    op.add_column('sao_static_item_list', sa.Column('ItemIcon', sa.VARCHAR(length=255), nullable=False))
    op.drop_index('sao_static_item_list_uk', table_name='sao_static_item_list')
    op.create_foreign_key(None, 'sao_static_item_list', 'sao_static_property', ['PropertyId'], ['PropertyId'], onupdate='cascade', ondelete='cascade')
    op.drop_column('sao_static_item_list', 'id')
    op.drop_column('sao_static_item_list', 'enabled')
    op.drop_column('sao_static_item_list', 'version')
    op.drop_column('sao_static_item_list', 'flavorText')
    op.drop_column('sao_static_item_list', 'rarity')
    op.drop_column('sao_static_item_list', 'name')
    op.drop_column('sao_static_item_list', 'itemTypeId')
    op.drop_column('sao_static_item_list', 'itemId')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('sao_static_quest', sa.Column('name', mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), nullable=True))
    op.add_column('sao_static_quest', sa.Column('sortNo', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_quest', sa.Column('questSceneId', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_quest', sa.Column('version', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_quest', sa.Column('enabled', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
    op.add_column('sao_static_quest', sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False))
    op.create_index('sao_static_quest_uk', 'sao_static_quest', ['version', 'questSceneId'], unique=False)
    op.drop_column('sao_static_quest', 'TrioRewardVp')
    op.drop_column('sao_static_quest', 'PairRewardVp')
    op.drop_column('sao_static_quest', 'SingleRewardVp')
    op.drop_column('sao_static_quest', 'TrioExpRate')
    op.drop_column('sao_static_quest', 'PairExpRate')
    op.drop_column('sao_static_quest', 'FailedPlayerExp')
    op.drop_column('sao_static_quest', 'SuccessPlayerExp')
    op.drop_column('sao_static_quest', 'PlayerTraceTableSubId')
    op.drop_column('sao_static_quest', 'RewardTableSubId')
    op.drop_column('sao_static_quest', 'LimitResurrection')
    op.drop_column('sao_static_quest', 'LimitDefault')
    op.drop_column('sao_static_quest', 'ColRate')
    op.drop_column('sao_static_quest', 'Tutorial')
    op.drop_column('sao_static_quest', 'SortNo')
    op.drop_column('sao_static_quest', 'QuestSceneId')
    op.add_column('sao_static_item_list', sa.Column('itemId', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_item_list', sa.Column('itemTypeId', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_item_list', sa.Column('name', mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), nullable=True))
    op.add_column('sao_static_item_list', sa.Column('rarity', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_item_list', sa.Column('flavorText', mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), nullable=True))
    op.add_column('sao_static_item_list', sa.Column('version', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_item_list', sa.Column('enabled', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
    op.add_column('sao_static_item_list', sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False))
    op.drop_constraint(None, 'sao_static_item_list', type_='foreignkey')
    op.create_index('sao_static_item_list_uk', 'sao_static_item_list', ['version', 'itemId'], unique=False)
    op.drop_column('sao_static_item_list', 'ItemIcon')
    op.drop_column('sao_static_item_list', 'SalePrice')
    op.drop_column('sao_static_item_list', 'FlavorText_en')
    op.drop_column('sao_static_item_list', 'FlavorText')
    op.drop_column('sao_static_item_list', 'PropertyValue2Max')
    op.drop_column('sao_static_item_list', 'PropertyValue2Min')
    op.drop_column('sao_static_item_list', 'PropertyValue1Max')
    op.drop_column('sao_static_item_list', 'PropertyValue1Min')
    op.drop_column('sao_static_item_list', 'PropertyId')
    op.drop_column('sao_static_item_list', 'Value')
    op.drop_column('sao_static_item_list', 'Rarity')
    op.drop_column('sao_static_item_list', 'Name_en')
    op.drop_column('sao_static_item_list', 'Name')
    op.drop_column('sao_static_item_list', 'ItemTypeId')
    op.drop_column('sao_static_item_list', 'ItemId')
    op.add_column('sao_static_hero_list', sa.Column('name', mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), nullable=True))
    op.add_column('sao_static_hero_list', sa.Column('rarity', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_hero_list', sa.Column('skillTableSubId', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_hero_list', sa.Column('heroLogId', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_hero_list', sa.Column('flavorText', mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), nullable=True))
    op.add_column('sao_static_hero_list', sa.Column('version', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_hero_list', sa.Column('enabled', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
    op.add_column('sao_static_hero_list', sa.Column('nickname', mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), nullable=True))
    op.add_column('sao_static_hero_list', sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False))
    op.add_column('sao_static_hero_list', sa.Column('awakeningExp', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'sao_static_hero_list', type_='foreignkey')
    op.drop_constraint(None, 'sao_static_hero_list', type_='foreignkey')
    op.drop_constraint(None, 'sao_static_hero_list', type_='foreignkey')
    op.drop_constraint(None, 'sao_static_hero_list', type_='foreignkey')
    op.drop_constraint(None, 'sao_static_hero_list', type_='foreignkey')
    op.drop_constraint(None, 'sao_static_hero_list', type_='foreignkey')
    op.create_index('sao_static_hero_list_uk', 'sao_static_hero_list', ['version', 'heroLogId'], unique=False)
    op.drop_column('sao_static_hero_list', 'CollectionEmptyFrameDisplayFlag')
    op.drop_column('sao_static_hero_list', 'Slot5UnlockLevel')
    op.drop_column('sao_static_hero_list', 'Slot4UnlockLevel')
    op.drop_column('sao_static_hero_list', 'AwakeningExp')
    op.drop_column('sao_static_hero_list', 'CompositionExp')
    op.drop_column('sao_static_hero_list', 'SalePrice')
    op.drop_column('sao_static_hero_list', 'FlavorText_en')
    op.drop_column('sao_static_hero_list', 'FlavorText')
    op.drop_column('sao_static_hero_list', 'Property4Value2')
    op.drop_column('sao_static_hero_list', 'Property4Value1')
    op.drop_column('sao_static_hero_list', 'Property4PropertyId')
    op.drop_column('sao_static_hero_list', 'Property3Value2')
    op.drop_column('sao_static_hero_list', 'Property3Value1')
    op.drop_column('sao_static_hero_list', 'Property3PropertyId')
    op.drop_column('sao_static_hero_list', 'Property2Value2')
    op.drop_column('sao_static_hero_list', 'Property2Value1')
    op.drop_column('sao_static_hero_list', 'Property2PropertyId')
    op.drop_column('sao_static_hero_list', 'Property1Value2')
    op.drop_column('sao_static_hero_list', 'Property1Value1')
    op.drop_column('sao_static_hero_list', 'Property1PropertyId')
    op.drop_column('sao_static_hero_list', 'IntMax')
    op.drop_column('sao_static_hero_list', 'IntMin')
    op.drop_column('sao_static_hero_list', 'VitMax')
    op.drop_column('sao_static_hero_list', 'VitMin')
    op.drop_column('sao_static_hero_list', 'StrMax')
    op.drop_column('sao_static_hero_list', 'StrMin')
    op.drop_column('sao_static_hero_list', 'HpMax')
    op.drop_column('sao_static_hero_list', 'HpMin')
    op.drop_column('sao_static_hero_list', 'SkillTableSubId')
    op.drop_column('sao_static_hero_list', 'DefaultEquipmentId2')
    op.drop_column('sao_static_hero_list', 'DefaultEquipmentId1')
    op.drop_column('sao_static_hero_list', 'UnitId')
    op.drop_column('sao_static_hero_list', 'CostumeTypeId')
    op.drop_column('sao_static_hero_list', 'HeroLogRoleId')
    op.drop_column('sao_static_hero_list', 'WeaponTypeId')
    op.drop_column('sao_static_hero_list', 'Rarity')
    op.drop_column('sao_static_hero_list', 'Nickname_en')
    op.drop_column('sao_static_hero_list', 'Name_en')
    op.drop_column('sao_static_hero_list', 'Nickname')
    op.drop_column('sao_static_hero_list', 'Name')
    op.drop_column('sao_static_hero_list', 'CharaId')
    op.drop_column('sao_static_hero_list', 'HeroLogId')
    op.add_column('sao_static_equipment_list', sa.Column('weaponTypeId', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_equipment_list', sa.Column('name', mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), nullable=True))
    op.add_column('sao_static_equipment_list', sa.Column('rarity', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_equipment_list', sa.Column('equipmentId', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_equipment_list', sa.Column('equipmentType', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_equipment_list', sa.Column('flavorText', mysql.VARCHAR(charset='utf8mb3', collation='utf8mb3_unicode_ci', length=255), nullable=True))
    op.add_column('sao_static_equipment_list', sa.Column('version', mysql.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('sao_static_equipment_list', sa.Column('enabled', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True))
    op.add_column('sao_static_equipment_list', sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False))
    op.drop_constraint(None, 'sao_static_equipment_list', type_='foreignkey')
    op.drop_constraint(None, 'sao_static_equipment_list', type_='foreignkey')
    op.drop_constraint(None, 'sao_static_equipment_list', type_='foreignkey')
    op.drop_constraint(None, 'sao_static_equipment_list', type_='foreignkey')
    op.create_index('sao_static_equipment_list_uk', 'sao_static_equipment_list', ['version', 'equipmentId'], unique=False)
    op.drop_column('sao_static_equipment_list', 'FlavorText_en')
    op.drop_column('sao_static_equipment_list', 'FlavorText')
    op.drop_column('sao_static_equipment_list', 'AwakeningExp')
    op.drop_column('sao_static_equipment_list', 'CompositionExp')
    op.drop_column('sao_static_equipment_list', 'SalePrice')
    op.drop_column('sao_static_equipment_list', 'Property4Value2')
    op.drop_column('sao_static_equipment_list', 'Property4Value1')
    op.drop_column('sao_static_equipment_list', 'Property4PropertyId')
    op.drop_column('sao_static_equipment_list', 'Property3Value2')
    op.drop_column('sao_static_equipment_list', 'Property3Value1')
    op.drop_column('sao_static_equipment_list', 'Property3PropertyId')
    op.drop_column('sao_static_equipment_list', 'Property2Value2')
    op.drop_column('sao_static_equipment_list', 'Property2Value1')
    op.drop_column('sao_static_equipment_list', 'Property2PropertyId')
    op.drop_column('sao_static_equipment_list', 'Property1Value2')
    op.drop_column('sao_static_equipment_list', 'Property1Value1')
    op.drop_column('sao_static_equipment_list', 'Property1PropertyId')
    op.drop_column('sao_static_equipment_list', 'SkillCondition')
    op.drop_column('sao_static_equipment_list', 'StrengthIncrement')
    op.drop_column('sao_static_equipment_list', 'Power')
    op.drop_column('sao_static_equipment_list', 'Rarity')
    op.drop_column('sao_static_equipment_list', 'Name_en')
    op.drop_column('sao_static_equipment_list', 'Name')
    op.drop_column('sao_static_equipment_list', 'WeaponTypeId')
    op.drop_column('sao_static_equipment_list', 'EquipmentType')
    op.drop_column('sao_static_equipment_list', 'EquipmentId')
    op.drop_constraint(None, 'sao_profile', type_='foreignkey')
    op.drop_column('sao_profile', 'login_ct')
    op.drop_column('sao_profile', 'ad_confirm_date')
    op.drop_column('sao_profile', 'last_login_bonus_date')
    op.drop_column('sao_profile', 'last_comeback_date')
    op.drop_column('sao_profile', 'last_bonus_yui_medal_date')
    op.drop_column('sao_profile', 'last_yui_medal_date')
    op.drop_column('sao_profile', 'last_login_date')
    op.drop_column('sao_profile', 'when_register')
    op.drop_column('sao_profile', 'fav_hero')
    op.drop_column('sao_profile', 'my_shop')
    op.add_column('sao_player_quest', sa.Column('episode_id', mysql.INTEGER(), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'sao_player_quest', type_='foreignkey')
    op.drop_constraint('sao_player_quest_uk', 'sao_player_quest', type_='unique')
    op.create_unique_constraint('sao_player_quest_uk', 'sao_player_quest', ['user', 'episode_id'])
    op.alter_column('sao_player_quest', 'play_date',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('CURRENT_TIMESTAMP'),
               existing_nullable=False)
    op.drop_column('sao_player_quest', 'quest_scene_id')
    op.drop_column('sao_player_quest', 'quest_type')
    op.alter_column('sao_play_sessions', 'play_date',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('CURRENT_TIMESTAMP'),
               existing_nullable=False)
    op.alter_column('sao_item_data', 'get_date',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('CURRENT_TIMESTAMP'),
               existing_nullable=False)
    op.drop_constraint(None, 'sao_hero_party', type_='foreignkey')
    op.drop_constraint(None, 'sao_hero_party', type_='foreignkey')
    op.drop_constraint(None, 'sao_hero_party', type_='foreignkey')
    op.add_column('sao_hero_log_data', sa.Column('user_hero_log_id', mysql.INTEGER(), autoincrement=False, nullable=False))
    op.drop_constraint(None, 'sao_hero_log_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_hero_log_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_hero_log_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_hero_log_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_hero_log_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_hero_log_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_hero_log_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_hero_log_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_hero_log_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_hero_log_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_hero_log_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_hero_log_data', type_='foreignkey')
    op.drop_constraint('sao_hero_log_data_uk', 'sao_hero_log_data', type_='unique')
    op.create_unique_constraint('sao_hero_log_data_uk', 'sao_hero_log_data', ['user', 'user_hero_log_id'])
    op.alter_column('sao_hero_log_data', 'get_date',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('CURRENT_TIMESTAMP'),
               existing_nullable=False)
    op.alter_column('sao_hero_log_data', 'skill_slot5_skill_id',
               existing_type=sa.BIGINT(),
               type_=mysql.INTEGER(),
               nullable=False)
    op.alter_column('sao_hero_log_data', 'skill_slot4_skill_id',
               existing_type=sa.BIGINT(),
               type_=mysql.INTEGER(),
               nullable=False)
    op.alter_column('sao_hero_log_data', 'skill_slot3_skill_id',
               existing_type=sa.BIGINT(),
               type_=mysql.INTEGER(),
               nullable=False)
    op.alter_column('sao_hero_log_data', 'skill_slot2_skill_id',
               existing_type=sa.BIGINT(),
               type_=mysql.INTEGER(),
               nullable=False)
    op.alter_column('sao_hero_log_data', 'skill_slot1_skill_id',
               existing_type=sa.BIGINT(),
               type_=mysql.INTEGER(),
               nullable=False)
    op.alter_column('sao_hero_log_data', 'sub_equipment',
               existing_type=sa.BIGINT(),
               type_=mysql.INTEGER(),
               nullable=False)
    op.alter_column('sao_hero_log_data', 'main_weapon',
               existing_type=sa.BIGINT(),
               type_=mysql.INTEGER(),
               nullable=False)
    op.drop_column('sao_hero_log_data', 'converted_card_num')
    op.drop_column('sao_hero_log_data', 'property4_value2')
    op.drop_column('sao_hero_log_data', 'property4_value1')
    op.drop_column('sao_hero_log_data', 'property4_property_id')
    op.drop_column('sao_hero_log_data', 'property3_value2')
    op.drop_column('sao_hero_log_data', 'property3_value1')
    op.drop_column('sao_hero_log_data', 'property3_property_id')
    op.drop_column('sao_hero_log_data', 'property2_value2')
    op.drop_column('sao_hero_log_data', 'property2_value1')
    op.drop_column('sao_hero_log_data', 'property2_property_id')
    op.drop_column('sao_hero_log_data', 'property1_value2')
    op.drop_column('sao_hero_log_data', 'property1_value1')
    op.drop_column('sao_hero_log_data', 'property1_property_id')
    op.drop_column('sao_hero_log_data', 'is_protect')
    op.drop_column('sao_hero_log_data', 'is_shop_purchase')
    op.drop_column('sao_hero_log_data', 'awakening_exp')
    op.drop_column('sao_hero_log_data', 'awakening_stage')
    op.drop_column('sao_hero_log_data', 'is_awakenable')
    op.drop_column('sao_hero_log_data', 'max_level_extend_num')
    op.drop_column('sao_hero_log_data', 'hero_log_id')
    op.drop_constraint(None, 'sao_equipment_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_equipment_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_equipment_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_equipment_data', type_='foreignkey')
    op.drop_constraint(None, 'sao_equipment_data', type_='foreignkey')
    op.alter_column('sao_equipment_data', 'get_date',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('CURRENT_TIMESTAMP'),
               existing_nullable=False)
    op.alter_column('sao_equipment_data', 'equipment_id',
               existing_type=sa.BIGINT(),
               type_=mysql.INTEGER(),
               existing_nullable=False)
    op.drop_column('sao_equipment_data', 'converted_card_num')
    op.drop_column('sao_equipment_data', 'property4_value2')
    op.drop_column('sao_equipment_data', 'property4_value1')
    op.drop_column('sao_equipment_data', 'property4_property_id')
    op.drop_column('sao_equipment_data', 'property3_value2')
    op.drop_column('sao_equipment_data', 'property3_value1')
    op.drop_column('sao_equipment_data', 'property3_property_id')
    op.drop_column('sao_equipment_data', 'property2_value2')
    op.drop_column('sao_equipment_data', 'property2_value1')
    op.drop_column('sao_equipment_data', 'property2_property_id')
    op.drop_column('sao_equipment_data', 'property1_value2')
    op.drop_column('sao_equipment_data', 'property1_value1')
    op.drop_column('sao_equipment_data', 'property1_property_id')
    op.drop_column('sao_equipment_data', 'is_protect')
    op.drop_column('sao_equipment_data', 'is_shop_purchase')
    op.alter_column('sao_end_sessions', 'play_date',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('CURRENT_TIMESTAMP'),
               existing_nullable=False)
    op.drop_table('sao_player_hero_card')
    op.drop_table('sao_player_ex_bonus')
    op.drop_table('sao_static_tower')
    op.drop_table('sao_static_skill_table')
    op.drop_table('sao_static_side_quest')
    op.drop_table('sao_static_ex_tower')
    op.drop_table('sao_static_ex_bonus')
    op.drop_table('sao_static_episode')
    op.drop_table('sao_player_tutorial')
    op.drop_table('sao_player_resource_card')
    op.drop_table('sao_player_beginner_mission')
    op.drop_table('sao_static_trace_table')
    op.drop_table('sao_static_skill')
    op.drop_table('sao_static_reward')
    op.drop_table('sao_static_property')
    # ### end Alembic commands ###
