From 171131493fdde88c69ea1ea01348f7e7cbfa3183 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Wed, 26 Jun 2024 23:57:07 -0400 Subject: [PATCH] sao: fix new issues --- .../680789dabab3_sao_player_changes.py | 53 +++++++++++-------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/core/data/alembic/versions/680789dabab3_sao_player_changes.py b/core/data/alembic/versions/680789dabab3_sao_player_changes.py index 414dd60..295a53e 100644 --- a/core/data/alembic/versions/680789dabab3_sao_player_changes.py +++ b/core/data/alembic/versions/680789dabab3_sao_player_changes.py @@ -97,6 +97,7 @@ def upgrade(): existing_type=mysql.TIMESTAMP(), server_default=sa.text('now()'), existing_nullable=False) + op.drop_index('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', ['property4_property_id'], ['PropertyId'], onupdate='cascade', ondelete='cascade') @@ -111,6 +112,7 @@ def upgrade(): 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.create_foreign_key(None, "sao_hero_log_data", "aime_user", ['user'], ['id']) 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') @@ -129,8 +131,10 @@ def upgrade(): existing_type=mysql.TIMESTAMP(), server_default=sa.text('now()'), existing_nullable=False) + op.drop_index('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'], onupdate='cascade', ondelete='cascade') 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)) @@ -147,8 +151,7 @@ def upgrade(): def downgrade(): - - op.drop_constraint(None, 'sao_profile', type_='foreignkey') + op.drop_constraint("sao_profile_ibfk_2", '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') @@ -160,9 +163,11 @@ def downgrade(): 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_ibfk_1", 'sao_player_quest', type_='foreignkey') + op.drop_constraint("sao_player_quest_ibfk_2", '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.create_foreign_key(None, 'sao_player_quest', 'aime_user', ['user'], ['id'], onupdate='cascade', ondelete='cascade') op.alter_column('sao_player_quest', 'play_date', existing_type=mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), @@ -177,24 +182,26 @@ def downgrade(): 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.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.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_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_unique_constraint('sao_hero_log_data_uk', 'sao_hero_log_data', ['user', 'user_hero_log_id']) + op.create_foreign_key(None, "sao_hero_log_data", "aime_user", ['user'], ['id']) op.alter_column('sao_hero_log_data', 'get_date', existing_type=mysql.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), @@ -247,11 +254,11 @@ def downgrade(): 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.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'),