From 40a66614bcfac371fe7447360158c5cbfe5b3582 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Thu, 27 Jun 2024 00:04:23 -0400 Subject: [PATCH] sao: fix user_hero_log_id --- .../versions/680789dabab3_sao_player_changes.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/data/alembic/versions/680789dabab3_sao_player_changes.py b/core/data/alembic/versions/680789dabab3_sao_player_changes.py index 295a53e..4fb953e 100644 --- a/core/data/alembic/versions/680789dabab3_sao_player_changes.py +++ b/core/data/alembic/versions/680789dabab3_sao_player_changes.py @@ -45,7 +45,6 @@ def upgrade(): 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)) @@ -97,6 +96,11 @@ def upgrade(): existing_type=mysql.TIMESTAMP(), server_default=sa.text('now()'), existing_nullable=False) + op.alter_column("sao_hero_log_data", "user_hero_log_id", + existing_type=sa.Integer(), + new_column_name="hero_log_id", + type_=sa.BIGINT(), + 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']) @@ -113,7 +117,6 @@ def upgrade(): 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') op.create_foreign_key(None, 'sao_hero_party', 'sao_hero_log_data', ['user_hero_log_id_2'], ['id'], onupdate='cascade', ondelete='cascade') @@ -185,7 +188,11 @@ def downgrade(): 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.alter_column("sao_hero_log_data", "hero_log_id", + existing_type=sa.BIGINT(), + new_column_name="user_hero_log_id", + type_=sa.Integer(), + nullable=False) 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') @@ -253,7 +260,6 @@ def downgrade(): 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("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')