"""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.drop_table('sao_static_quest')
    op.create_table('sao_static_quest',
    sa.Column('QuestSceneId', sa.BIGINT(), nullable=False),
    sa.Column('SortNo', sa.INTEGER(), nullable=False),
    sa.Column('Tutorial', sa.BOOLEAN(), nullable=False),
    sa.Column('ColRate', sa.DECIMAL(), nullable=False),
    sa.Column('LimitDefault', sa.INTEGER(), nullable=False),
    sa.Column('LimitResurrection', sa.INTEGER(), nullable=False),
    sa.Column('RewardTableSubId', sa.INTEGER(), nullable=False),
    sa.Column('PlayerTraceTableSubId', sa.INTEGER(), nullable=False),
    sa.Column('SuccessPlayerExp', sa.INTEGER(), nullable=False),
    sa.Column('FailedPlayerExp', sa.INTEGER(), nullable=False),
    sa.Column('PairExpRate', sa.INTEGER(), nullable=False),
    sa.Column('TrioExpRate', sa.INTEGER(), nullable=False),
    sa.Column('SingleRewardVp', sa.INTEGER(), nullable=False),
    sa.Column('PairRewardVp', sa.INTEGER(), nullable=False),
    sa.Column('TrioRewardVp', sa.INTEGER(), nullable=False),
    sa.PrimaryKeyConstraint('QuestSceneId'),
    mysql_charset='utf8mb4'
    )
    
    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.drop_table('sao_static_equipment_list')
    op.create_table("sao_static_equipment_list",
    sa.Column("EquipmentId", sa.BIGINT, primary_key=True, nullable=False),
    sa.Column("EquipmentType", sa.INTEGER, nullable=False),
    sa.Column("WeaponTypeId", sa.INTEGER, nullable=False),
    sa.Column("Name", sa.VARCHAR(255), nullable=False),
    sa.Column("Name_en", sa.VARCHAR(255)),
    sa.Column("Rarity", sa.INTEGER, nullable=False),
    sa.Column("Power", sa.INTEGER, nullable=False),
    sa.Column("StrengthIncrement", sa.INTEGER, nullable=False),
    sa.Column("SkillCondition", sa.INTEGER, nullable=False),
    sa.Column("Property1PropertyId", sa.BIGINT, sa.ForeignKey("sao_static_property.PropertyId", ondelete="cascade", onupdate="cascade"), nullable=False),
    sa.Column("Property1Value1", sa.INTEGER, nullable=False),
    sa.Column("Property1Value2", sa.INTEGER, nullable=False),
    sa.Column("Property2PropertyId", sa.BIGINT, sa.ForeignKey("sao_static_property.PropertyId", ondelete="cascade", onupdate="cascade"), nullable=False),
    sa.Column("Property2Value1", sa.INTEGER, nullable=False),
    sa.Column("Property2Value2", sa.INTEGER, nullable=False),
    sa.Column("Property3PropertyId", sa.BIGINT, sa.ForeignKey("sao_static_property.PropertyId", ondelete="cascade", onupdate="cascade"), nullable=False),
    sa.Column("Property3Value1", sa.INTEGER, nullable=False),
    sa.Column("Property3Value2", sa.INTEGER, nullable=False),
    sa.Column("Property4PropertyId", sa.BIGINT, sa.ForeignKey("sao_static_property.PropertyId", ondelete="cascade", onupdate="cascade"), nullable=False),
    sa.Column("Property4Value1", sa.INTEGER, nullable=False),
    sa.Column("Property4Value2", sa.INTEGER, nullable=False),
    sa.Column("SalePrice", sa.INTEGER, nullable=False),
    sa.Column("CompositionExp", sa.INTEGER, nullable=False),
    sa.Column("AwakeningExp", sa.INTEGER, nullable=False),
    sa.Column("FlavorText", sa.VARCHAR(255), nullable=False),
    sa.Column("FlavorText_en", sa.VARCHAR(255)),
    mysql_charset="utf8mb4"
   )
    
    op.drop_table('sao_static_hero_list')
    op.create_table("sao_static_hero_list",
    sa.Column("HeroLogId", sa.BIGINT, primary_key=True, nullable=False),
    sa.Column("CharaId", sa.INTEGER, nullable=False),
    sa.Column("Name", sa.VARCHAR(255), nullable=False),
    sa.Column("Nickname", sa.VARCHAR(255), nullable=False),
    sa.Column("Name_en", sa.VARCHAR(255)),
    sa.Column("Nickname_en", sa.VARCHAR(255)),
    sa.Column("Rarity", sa.INTEGER, nullable=False),
    sa.Column("WeaponTypeId", sa.INTEGER, nullable=False),
    sa.Column("HeroLogRoleId", sa.INTEGER, nullable=False),
    sa.Column("CostumeTypeId", sa.INTEGER, nullable=False),
    sa.Column("UnitId", sa.INTEGER, nullable=False),
    sa.Column("DefaultEquipmentId1", sa.BIGINT, sa.ForeignKey("sao_static_equipment_list.EquipmentId", ondelete="cascade", onupdate="cascade")),
    sa.Column("DefaultEquipmentId2", sa.BIGINT, sa.ForeignKey("sao_static_equipment_list.EquipmentId", ondelete="cascade", onupdate="cascade")),
    sa.Column("SkillTableSubId", sa.INTEGER, nullable=False),
    sa.Column("HpMin", sa.INTEGER, nullable=False),
    sa.Column("HpMax", sa.INTEGER, nullable=False),
    sa.Column("StrMin", sa.INTEGER, nullable=False),
    sa.Column("StrMax", sa.INTEGER, nullable=False),
    sa.Column("VitMin", sa.INTEGER, nullable=False),
    sa.Column("VitMax", sa.INTEGER, nullable=False),
    sa.Column("IntMin", sa.INTEGER, nullable=False),
    sa.Column("IntMax", sa.INTEGER, nullable=False),
    sa.Column("Property1PropertyId", sa.BIGINT, sa.ForeignKey("sao_static_property.PropertyId", ondelete="cascade", onupdate="cascade"), nullable=False),
    sa.Column("Property1Value1", sa.INTEGER, nullable=False),
    sa.Column("Property1Value2", sa.INTEGER, nullable=False),
    sa.Column("Property2PropertyId", sa.BIGINT, sa.ForeignKey("sao_static_property.PropertyId", ondelete="cascade", onupdate="cascade"), nullable=False),
    sa.Column("Property2Value1", sa.INTEGER, nullable=False),
    sa.Column("Property2Value2", sa.INTEGER, nullable=False),
    sa.Column("Property3PropertyId", sa.BIGINT, sa.ForeignKey("sao_static_property.PropertyId", ondelete="cascade", onupdate="cascade"), nullable=False),
    sa.Column("Property3Value1", sa.INTEGER, nullable=False),
    sa.Column("Property3Value2", sa.INTEGER, nullable=False),
    sa.Column("Property4PropertyId", sa.BIGINT, sa.ForeignKey("sao_static_property.PropertyId", ondelete="cascade", onupdate="cascade"), nullable=False),
    sa.Column("Property4Value1", sa.INTEGER, nullable=False),
    sa.Column("Property4Value2", sa.INTEGER, nullable=False),
    sa.Column("FlavorText", sa.VARCHAR(255), nullable=False),
    sa.Column("FlavorText_en", sa.VARCHAR(255)),
    sa.Column("SalePrice", sa.INTEGER, nullable=False),
    sa.Column("CompositionExp", sa.INTEGER, nullable=False),
    sa.Column("AwakeningExp", sa.INTEGER, nullable=False),
    sa.Column("Slot4UnlockLevel", sa.INTEGER, nullable=False),
    sa.Column("Slot5UnlockLevel", sa.INTEGER, nullable=False),
    sa.Column("CollectionEmptyFrameDisplayFlag", sa.BOOLEAN, nullable=False),
    mysql_charset="utf8mb4"
    )

    op.drop_table('sao_static_item_list')
    op.create_table("sao_static_item_list",
        sa.Column("ItemId", sa.INTEGER, nullable=False, primary_key=True),
        sa.Column("ItemTypeId", sa.INTEGER, nullable=False),
        sa.Column("Name", sa.VARCHAR(255), nullable=False),
        sa.Column("Name_en", sa.VARCHAR(255)),
        sa.Column("Rarity", sa.INTEGER, nullable=False),
        sa.Column("Value", sa.INTEGER, nullable=False),
        sa.Column("PropertyId", sa.BIGINT, sa.ForeignKey("sao_static_property.PropertyId", ondelete="cascade", onupdate="cascade"), nullable=False),
        sa.Column("PropertyValue1Min", sa.INTEGER, nullable=False),
        sa.Column("PropertyValue1Max", sa.INTEGER, nullable=False),
        sa.Column("PropertyValue2Min", sa.INTEGER, nullable=False),
        sa.Column("PropertyValue2Max", sa.INTEGER, nullable=False),
        sa.Column("FlavorText", sa.VARCHAR(255), nullable=False),
        sa.Column("FlavorText_en", sa.VARCHAR(255)),
        sa.Column("SalePrice", sa.INTEGER, nullable=False),
        sa.Column("ItemIcon", sa.VARCHAR(255), nullable=False),
        mysql_charset="utf8mb4"
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('sao_static_item_list')
    op.create_table("sao_static_item_list",
    sa.Column("id", sa.Integer, primary_key=True, nullable=False),
    sa.Column("version", sa.Integer),
    sa.Column("itemId", sa.Integer),
    sa.Column("itemTypeId", sa.Integer),
    sa.Column("name", sa.String(255)),
    sa.Column("rarity", sa.Integer),
    sa.Column("flavorText", sa.String(255)),
    sa.Column("enabled", sa.Boolean),
    sa.UniqueConstraint(
        "version", "itemId", name="sao_static_item_list_uk"
    ),
    mysql_charset="utf8mb4"
    )

    op.drop_table('sao_static_hero_list')
    op.create_table("sao_static_hero_list",
    sa.Column("id", sa.Integer, primary_key=True, nullable=False),
    sa.Column("version", sa.Integer),
    sa.Column("heroLogId", sa.Integer),
    sa.Column("name", sa.String(255)),
    sa.Column("nickname", sa.String(255)),
    sa.Column("rarity", sa.Integer),
    sa.Column("skillTableSubId", sa.Integer),
    sa.Column("awakeningExp", sa.Integer),
    sa.Column("flavorText", sa.String(255)),
    sa.Column("enabled", sa.Boolean),
    sa.UniqueConstraint(
        "version", "heroLogId", name="sao_static_hero_list_uk"
    ),
    mysql_charset="utf8mb4",
    )

    op.drop_table('sao_static_equipment_list')
    op.create_table("sao_static_equipment_list",
    sa.Column("id", sa.Integer, primary_key=True, nullable=False),
    sa.Column("version", sa.Integer),
    sa.Column("equipmentId", sa.Integer),
    sa.Column("equipmentType", sa.Integer),
    sa.Column("weaponTypeId", sa.Integer),
    sa.Column("name", sa.String(255)),
    sa.Column("rarity", sa.Integer),
    sa.Column("flavorText", sa.String(255)),
    sa.Column("enabled", sa.Boolean),
    sa.UniqueConstraint(
        "version", "equipmentId", name="sao_static_equipment_list_uk"
    ),
    mysql_charset="utf8mb4"

   )

    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')
    op.drop_table('sao_static_quest')
    op.create_table('sao_static_quest',
    sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False),
    sa.Column('enabled', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.Column('version', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('questSceneId', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('sortNo', mysql.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('name', mysql.VARCHAR(charset='utf8mb4', collation='utf8mb4_general_ci', length=255), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint("version", "questSceneId", name="sao_static_quest_uk"),
    mysql_charset='utf8mb4'
    )
    # ### end Alembic commands ###
