From 7206af83cb2d794cf8b22671c81a01b2780d81c4 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Wed, 26 Jun 2024 22:30:12 -0400 Subject: [PATCH] sao: fix upgrade script --- .../versions/a616fd164e40_sao_backport.py | 759 ++++++++++-------- 1 file changed, 418 insertions(+), 341 deletions(-) diff --git a/core/data/alembic/versions/a616fd164e40_sao_backport.py b/core/data/alembic/versions/a616fd164e40_sao_backport.py index c4b885b..93b5993 100644 --- a/core/data/alembic/versions/a616fd164e40_sao_backport.py +++ b/core/data/alembic/versions/a616fd164e40_sao_backport.py @@ -18,29 +18,81 @@ depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.drop_index('sao_static_quest_uk', table_name='sao_static_quest') - op.drop_column('sao_static_quest', 'questSceneId') - op.drop_column('sao_static_quest', 'name') - op.drop_column('sao_static_quest', 'sortNo') - op.drop_column('sao_static_quest', 'id') - op.drop_column('sao_static_quest', 'enabled') - 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.create_primary_key(None, "sao_static_quest", ['QuestSceneId']) - op.drop_column('sao_static_quest', 'version') + 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), @@ -159,11 +211,22 @@ def upgrade(): 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.alter_column("sao_equipment_data", "equipment_id", existing_type=sa.Integer(), type_=sa.BIGINT()) 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)) @@ -179,18 +242,118 @@ def upgrade(): 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.drop_column('sao_static_equipment_list', 'id') - op.drop_column('sao_static_equipment_list', 'name') - op.drop_column('sao_static_equipment_list', 'flavorText') - op.drop_column('sao_static_equipment_list', 'equipmentId') - op.drop_column('sao_static_equipment_list', 'rarity') - op.drop_column('sao_static_equipment_list', 'enabled') - op.drop_column('sao_static_equipment_list', 'weaponTypeId') - op.drop_column('sao_static_equipment_list', 'equipmentType') + 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)) @@ -217,92 +380,20 @@ def upgrade(): 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.create_primary_key(None, "sao_static_equipment_list", ['EquipmentId']) 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', ['Property1PropertyId'], ['PropertyId'], onupdate='cascade', ondelete='cascade') 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.create_foreign_key(None, 'sao_equipment_data', 'sao_static_equipment_list', ['equipment_id'], ['EquipmentId'], 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_property', ['property4_property_id'], ['PropertyId'], onupdate='cascade', ondelete='cascade') - 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', ['property3_property_id'], ['PropertyId'], 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(display_width=11), - nullable=True) - op.alter_column('sao_hero_log_data', 'sub_equipment', - existing_type=mysql.INTEGER(display_width=11), - nullable=True) - op.alter_column('sao_hero_log_data', 'skill_slot1_skill_id', - existing_type=mysql.INTEGER(display_width=11), - type_=sa.BIGINT(), - nullable=True) - op.alter_column('sao_hero_log_data', 'skill_slot2_skill_id', - existing_type=mysql.INTEGER(display_width=11), - type_=sa.BIGINT(), - nullable=True) - op.alter_column('sao_hero_log_data', 'skill_slot3_skill_id', - existing_type=mysql.INTEGER(display_width=11), - type_=sa.BIGINT(), - nullable=True) - op.alter_column('sao_hero_log_data', 'skill_slot4_skill_id', - existing_type=mysql.INTEGER(display_width=11), - type_=sa.BIGINT(), - nullable=True) - op.alter_column('sao_hero_log_data', 'skill_slot5_skill_id', - existing_type=mysql.INTEGER(display_width=11), - 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_ibfk_1', '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', 'hero_log_id']) - op.create_foreign_key(None, 'sao_hero_log_data', 'sao_static_property', ['property2_property_id'], ['PropertyId'], onupdate='cascade', ondelete='cascade') - 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_property', ['property1_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_equipment_data', ['main_weapon'], ['id'], onupdate='set null', ondelete='set null') - 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_slot4_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_static_property', ['property3_property_id'], ['PropertyId'], onupdate='cascade', ondelete='cascade') - 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_skill', ['skill_slot5_skill_id'], ['SkillId'], onupdate='set null', ondelete='set null') - op.drop_index('sao_static_hero_list_uk', table_name='sao_static_hero_list') - op.drop_column('sao_static_hero_list', 'name') - op.drop_column('sao_static_hero_list', 'skillTableSubId') - op.drop_column('sao_static_hero_list', 'awakeningExp') - op.drop_column('sao_static_hero_list', 'flavorText') - op.drop_column('sao_static_hero_list', 'heroLogId') - op.drop_column('sao_static_hero_list', 'id') - op.drop_column('sao_static_hero_list', 'rarity') - op.drop_column('sao_static_hero_list', 'version') - op.drop_column('sao_static_hero_list', 'nickname') + 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)) @@ -345,74 +436,23 @@ def upgrade(): 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_equipment_list', ['DefaultEquipmentId2'], ['EquipmentId'], 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', ['Property3PropertyId'], ['PropertyId'], onupdate='cascade', ondelete='cascade') - op.create_foreign_key(None, 'sao_static_hero_list', 'sao_static_property', ['Property4PropertyId'], ['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.create_primary_key(None, "sao_static_hero_list", ["HeroLogId"]) - op.create_foreign_key(None, 'sao_hero_log_data', 'sao_static_hero_list', ['hero_log_id'], ['HeroLogId'], onupdate='cascade', ondelete='cascade') - op.drop_column('sao_hero_log_data', 'user_hero_log_id') - op.create_foreign_key(None, 'sao_hero_log_data', 'aime_user', ['user'], ['id'], onupdate='cascade', ondelete='cascade') - 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.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_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_ibfk_1', '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', 'quest_scene_id']) - op.create_foreign_key(None, "sao_player_quest", "aime_user", ['user'], ['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.alter_column('sao_profile', 'own_vp', - existing_type=mysql.INTEGER(display_width=11), - server_default='0', - existing_nullable=True) - op.create_foreign_key(None, 'sao_profile', 'sao_hero_log_data', ['fav_hero'], ['id'], onupdate='cascade', ondelete='set null') - op.drop_column('sao_static_item_list', 'name') - op.drop_column('sao_static_item_list', 'itemId') - op.drop_column('sao_static_item_list', 'itemTypeId') - op.drop_column('sao_static_item_list', 'flavorText') - op.drop_column('sao_static_item_list', 'id') - op.drop_column('sao_static_item_list', 'rarity') - op.drop_column('sao_static_item_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)) @@ -430,13 +470,73 @@ def upgrade(): 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') + 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') # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.drop_constraint("sao_static_item_list_ibfk_1", 'sao_static_item_list', type_='foreignkey') + 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') @@ -448,87 +548,27 @@ def downgrade(): 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_item_list', sa.Column('version', mysql.INTEGER(display_width=11), 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('rarity', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - op.add_column('sao_static_item_list', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False)) - op.add_column('sao_static_item_list', sa.Column('flavorText', mysql.VARCHAR(length=255), nullable=True)) - op.add_column('sao_static_item_list', sa.Column('itemTypeId', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - op.add_column('sao_static_item_list', sa.Column('itemId', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - op.add_column('sao_static_item_list', sa.Column('name', mysql.VARCHAR(length=255), nullable=True)) - op.add_column('sao_hero_log_data', sa.Column('user_hero_log_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False)) - op.drop_column('sao_static_item_list', 'Name_en') - op.create_index('sao_static_item_list_uk', 'sao_static_item_list', ['version', 'itemId'], unique=True) - op.drop_constraint("sao_hero_log_data_ibfk_1", 'sao_hero_log_data', type_='foreignkey') - op.drop_constraint("sao_hero_log_data_ibfk_2", 'sao_hero_log_data', type_='foreignkey') - op.drop_constraint("sao_hero_log_data_ibfk_3", 'sao_hero_log_data', type_='foreignkey') - op.drop_constraint("sao_hero_log_data_ibfk_4", 'sao_hero_log_data', type_='foreignkey') - op.drop_constraint("sao_hero_log_data_ibfk_5", 'sao_hero_log_data', type_='foreignkey') - op.drop_constraint("sao_hero_log_data_ibfk_6", 'sao_hero_log_data', type_='foreignkey') - op.drop_constraint("sao_hero_log_data_ibfk_7", 'sao_hero_log_data', type_='foreignkey') - op.drop_constraint("sao_hero_log_data_ibfk_8", 'sao_hero_log_data', type_='foreignkey') - op.drop_constraint("sao_hero_log_data_ibfk_9", 'sao_hero_log_data', type_='foreignkey') - op.drop_constraint("sao_hero_log_data_ibfk_10", 'sao_hero_log_data', type_='foreignkey') - op.drop_constraint("sao_hero_log_data_ibfk_11", 'sao_hero_log_data', type_='foreignkey') - op.drop_constraint("sao_hero_log_data_ibfk_12", 'sao_hero_log_data', type_='foreignkey') - op.drop_constraint("sao_hero_log_data_ibfk_13", 'sao_hero_log_data', type_='foreignkey') - op.drop_constraint('sao_hero_log_data_uk', 'sao_hero_log_data', type_='unique') - op.create_foreign_key("sao_hero_log_data_ibfk_1", 'sao_hero_log_data', "aime_user", ['user'], ['id']) - 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.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=mysql.INTEGER(display_width=11), - nullable=False) - op.alter_column('sao_hero_log_data', 'skill_slot4_skill_id', - existing_type=mysql.INTEGER(display_width=11), - nullable=False) - op.alter_column('sao_hero_log_data', 'skill_slot3_skill_id', - existing_type=mysql.INTEGER(display_width=11), - nullable=False) - op.alter_column('sao_hero_log_data', 'skill_slot2_skill_id', - existing_type=mysql.INTEGER(display_width=11), - nullable=False) - op.alter_column('sao_hero_log_data', 'skill_slot1_skill_id', - existing_type=mysql.INTEGER(display_width=11), - nullable=False) - op.alter_column('sao_hero_log_data', 'sub_equipment', - existing_type=mysql.INTEGER(display_width=11), - nullable=False) - op.alter_column('sao_hero_log_data', 'main_weapon', - existing_type=mysql.INTEGER(display_width=11), - nullable=False) - op.create_unique_constraint('sao_hero_log_data_uk', 'sao_hero_log_data', ['user', 'user_hero_log_id']) - op.drop_constraint("sao_static_hero_list_ibfk_1", 'sao_static_hero_list', type_='foreignkey') - op.drop_constraint("sao_static_hero_list_ibfk_2", 'sao_static_hero_list', type_='foreignkey') - op.drop_constraint("sao_static_hero_list_ibfk_3", 'sao_static_hero_list', type_='foreignkey') - op.drop_constraint("sao_static_hero_list_ibfk_4", 'sao_static_hero_list', type_='foreignkey') - op.drop_constraint("sao_static_hero_list_ibfk_5", 'sao_static_hero_list', type_='foreignkey') - op.drop_constraint("sao_static_hero_list_ibfk_6", 'sao_static_hero_list', type_='foreignkey') + 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') @@ -556,6 +596,7 @@ def downgrade(): 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') @@ -570,46 +611,20 @@ def downgrade(): 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_hero_list', sa.Column('nickname', mysql.VARCHAR(length=255), nullable=True)) - op.add_column('sao_static_hero_list', sa.Column('version', mysql.INTEGER(display_width=11), 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('rarity', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - op.add_column('sao_static_hero_list', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False)) - op.add_column('sao_static_hero_list', sa.Column('heroLogId', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - op.add_column('sao_static_hero_list', sa.Column('flavorText', mysql.VARCHAR(length=255), nullable=True)) - op.add_column('sao_static_hero_list', sa.Column('awakeningExp', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - op.add_column('sao_static_hero_list', sa.Column('skillTableSubId', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - op.add_column('sao_static_hero_list', sa.Column('name', mysql.VARCHAR(length=255), nullable=True)) - op.drop_column('sao_static_hero_list', 'HpMin') - op.create_index('sao_static_hero_list_uk', 'sao_static_hero_list', ['version', 'heroLogId'], unique=True) - op.drop_constraint("sao_equipment_data_ibfk_2", 'sao_equipment_data', type_='foreignkey') - op.drop_constraint("sao_equipment_data_ibfk_3", 'sao_equipment_data', type_='foreignkey') - op.drop_constraint("sao_equipment_data_ibfk_4", 'sao_equipment_data', type_='foreignkey') - op.drop_constraint("sao_equipment_data_ibfk_5", 'sao_equipment_data', type_='foreignkey') - op.drop_constraint("sao_equipment_data_ibfk_6", '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.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.drop_constraint("sao_static_equipment_list_ibfk_1", 'sao_static_equipment_list', type_='foreignkey') - op.drop_constraint("sao_static_equipment_list_ibfk_2", 'sao_static_equipment_list', type_='foreignkey') - op.drop_constraint("sao_static_equipment_list_ibfk_3", 'sao_static_equipment_list', type_='foreignkey') - op.drop_constraint("sao_static_equipment_list_ibfk_4", 'sao_static_equipment_list', type_='foreignkey') + 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') @@ -631,26 +646,12 @@ def downgrade(): 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.add_column('sao_static_equipment_list', sa.Column('equipmentType', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - op.add_column('sao_static_equipment_list', sa.Column('version', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - op.add_column('sao_static_equipment_list', sa.Column('weaponTypeId', mysql.INTEGER(display_width=11), 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('rarity', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - op.add_column('sao_static_equipment_list', sa.Column('equipmentId', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - op.add_column('sao_static_equipment_list', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False)) - op.add_column('sao_static_equipment_list', sa.Column('flavorText', mysql.VARCHAR(length=255), nullable=True)) - op.add_column('sao_static_equipment_list', sa.Column('name', mysql.VARCHAR(length=255), nullable=True)) - op.drop_column('sao_static_equipment_list', 'Name_en') - op.create_index('sao_static_equipment_list_uk', 'sao_static_equipment_list', ['version', 'equipmentId'], unique=True) - op.drop_constraint("sao_profile_ibfk_2", 'sao_profile', type_='foreignkey') - op.alter_column('sao_profile', 'own_vp', - existing_type=mysql.INTEGER(display_width=11), - server_default=sa.text("'300'"), - existing_nullable=True) + 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') @@ -661,11 +662,9 @@ def downgrade(): 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(display_width=11), autoincrement=False, nullable=False)) - op.drop_constraint("sao_player_quest_ibfk_2", 'sao_player_quest', type_='foreignkey') - op.drop_constraint("sao_player_quest_ibfk_1", 'sao_player_quest', type_='foreignkey') + 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_foreign_key("sao_player_quest_ibfk_1", "sao_player_quest", "aime_user", ['user'], ['id']) 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(), @@ -681,9 +680,104 @@ def downgrade(): existing_type=mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), existing_nullable=False) - op.drop_constraint("sao_hero_party_ibfk_2", 'sao_hero_party', type_='foreignkey') - op.drop_constraint("sao_hero_party_ibfk_3", 'sao_hero_party', type_='foreignkey') - op.drop_constraint("sao_hero_party_ibfk_4", 'sao_hero_party', type_='foreignkey') + 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'), @@ -698,26 +792,9 @@ def downgrade(): op.drop_table('sao_static_episode') op.drop_table('sao_player_tutorial') op.drop_table('sao_player_resource_card') - op.add_column('sao_static_quest', sa.Column('version', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - 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_quest', sa.Column('enabled', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True)) - op.add_column('sao_static_quest', sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False)) - op.add_column('sao_static_quest', sa.Column('questSceneId', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - op.add_column('sao_static_quest', sa.Column('sortNo', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) - op.add_column('sao_static_quest', sa.Column('name', mysql.VARCHAR(length=255), nullable=True)) - op.create_index('sao_static_quest_uk', 'sao_static_quest', ['version', 'questSceneId'], unique=True) + 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 ###