"""acc_opt_tables

Revision ID: 263884e774cc
Revises: 1d0014d35220
Create Date: 2025-04-07 18:05:53.349320

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

# revision identifiers, used by Alembic.
revision = '263884e774cc'
down_revision = '1d0014d35220'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('chuni_static_opt',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('version', sa.INTEGER(), nullable=False),
    sa.Column('name', sa.VARCHAR(length=4), nullable=False),
    sa.Column('sequence', sa.INTEGER(), nullable=False),
    sa.Column('whenRead', sa.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
    sa.Column('isEnable', sa.BOOLEAN(), server_default='1', nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('version', 'name', name='chuni_static_opt_uk'),
    mysql_charset='utf8mb4'
    )
    op.create_table('cm_static_opts',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('version', sa.INTEGER(), nullable=False),
    sa.Column('name', sa.VARCHAR(length=4), nullable=False),
    sa.Column('sequence', sa.INTEGER(), nullable=True),
    sa.Column('gekiVersion', sa.INTEGER(), nullable=True),
    sa.Column('gekiReleaseVer', sa.INTEGER(), nullable=True),
    sa.Column('maiVersion', sa.INTEGER(), nullable=True),
    sa.Column('maiReleaseVer', sa.INTEGER(), nullable=True),
    sa.Column('whenRead', sa.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
    sa.Column('isEnable', sa.BOOLEAN(), server_default='1', nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('version', 'name', name='cm_static_opts_uk'),
    mysql_charset='utf8mb4'
    )
    op.create_table('mai2_static_opt',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('version', sa.INTEGER(), nullable=False),
    sa.Column('name', sa.VARCHAR(length=4), nullable=False),
    sa.Column('sequence', sa.INTEGER(), nullable=False),
    sa.Column('cmReleaseVer', sa.INTEGER(), nullable=False),
    sa.Column('whenRead', sa.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
    sa.Column('isEnable', sa.BOOLEAN(), server_default='1', nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('version', 'name', name='mai2_static_opt_uk'),
    mysql_charset='utf8mb4'
    )
    op.create_table('ongeki_static_opt',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('version', sa.INTEGER(), nullable=False),
    sa.Column('name', sa.VARCHAR(length=4), nullable=False),
    sa.Column('sequence', sa.INTEGER(), nullable=False),
    sa.Column('cmReleaseVer', sa.INTEGER(), nullable=False),
    sa.Column('whenRead', sa.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
    sa.Column('isEnable', sa.BOOLEAN(), server_default='1', nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('version', 'name', name='ongeki_static_opt_uk'),
    mysql_charset='utf8mb4'
    )
    op.add_column('chuni_static_avatar', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'chuni_static_avatar', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('chuni_static_cards', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'chuni_static_cards', 'cm_static_opts', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('chuni_static_character', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'chuni_static_character', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('chuni_static_charge', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'chuni_static_charge', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('chuni_static_events', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'chuni_static_events', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('chuni_static_gachas', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'chuni_static_gachas', 'cm_static_opts', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('chuni_static_login_bonus', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'chuni_static_login_bonus', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('chuni_static_login_bonus_preset', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'chuni_static_login_bonus_preset', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('chuni_static_map_icon', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'chuni_static_map_icon', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('chuni_static_music', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'chuni_static_music', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('chuni_static_system_voice', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'chuni_static_system_voice', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('chuni_static_trophy', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'chuni_static_trophy', 'chuni_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('mai2_static_cards', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'mai2_static_cards', 'cm_static_opts', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('mai2_static_event', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'mai2_static_event', 'mai2_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('mai2_static_music', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'mai2_static_music', 'mai2_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('mai2_static_ticket', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'mai2_static_ticket', 'mai2_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('ongeki_static_cards', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'ongeki_static_cards', 'ongeki_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('ongeki_static_events', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'ongeki_static_events', 'ongeki_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('ongeki_static_gachas', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'ongeki_static_gachas', 'cm_static_opts', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('ongeki_static_music', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'ongeki_static_music', 'ongeki_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    op.add_column('ongeki_static_rewards', sa.Column('opt', sa.BIGINT(), nullable=True))
    op.create_foreign_key(None, 'ongeki_static_rewards', 'ongeki_static_opt', ['opt'], ['id'], onupdate='cascade', ondelete='SET NULL')
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint("ongeki_static_rewards_ibfk_1", 'ongeki_static_rewards', type_='foreignkey')
    op.drop_column('ongeki_static_rewards', 'opt')
    op.drop_constraint("ongeki_static_music_ibfk_1", 'ongeki_static_music', type_='foreignkey')
    op.drop_column('ongeki_static_music', 'opt')
    op.drop_constraint("ongeki_static_gachas_ibfk_1", 'ongeki_static_gachas', type_='foreignkey')
    op.drop_column('ongeki_static_gachas', 'opt')
    op.drop_constraint("ongeki_static_events_ibfk_1", "ongeki_static_events", type_='foreignkey')
    op.drop_column('ongeki_static_events', 'opt')
    op.drop_constraint("ongeki_static_cards_ibfk_1", "ongeki_static_cards", type_='foreignkey')
    op.drop_column('ongeki_static_cards', 'opt')
    op.drop_constraint("mai2_static_ticket_ibfk_1", "mai2_static_ticket", type_='foreignkey')
    op.drop_column('mai2_static_ticket', 'opt')
    op.drop_constraint("mai2_static_music_ibfk_1", "mai2_static_music", type_='foreignkey')
    op.drop_column('mai2_static_music', 'opt')
    op.drop_constraint("mai2_static_event_ibfk_1", "mai2_static_event", type_='foreignkey')
    op.drop_column('mai2_static_event', 'opt')
    op.drop_constraint("mai2_static_cards_ibfk_1", "mai2_static_cards", type_='foreignkey')
    op.drop_column('mai2_static_cards', 'opt')
    op.drop_constraint("chuni_static_trophy_ibfk_1", "chuni_static_trophy", type_='foreignkey')
    op.drop_column('chuni_static_trophy', 'opt')
    op.drop_constraint("chuni_static_system_voice_ibfk_1", "chuni_static_system_voice", type_='foreignkey')
    op.drop_column('chuni_static_system_voice', 'opt')
    op.drop_constraint("chuni_static_music_ibfk_1", "chuni_static_music", type_='foreignkey')
    op.drop_column('chuni_static_music', 'opt')
    op.drop_constraint("chuni_static_map_icon_ibfk_1", "chuni_static_map_icon", type_='foreignkey')
    op.drop_column('chuni_static_map_icon', 'opt')
    op.drop_constraint("chuni_static_login_bonus_preset_ibfk_1", "chuni_static_login_bonus_preset", type_='foreignkey')
    op.drop_column('chuni_static_login_bonus_preset', 'opt')
    op.drop_constraint("chuni_static_login_bonus_ibfk_2", "chuni_static_login_bonus", type_='foreignkey')
    op.drop_column('chuni_static_login_bonus', 'opt')
    op.drop_constraint("chuni_static_gachas_ibfk_1", "chuni_static_gachas", type_='foreignkey')
    op.drop_column('chuni_static_gachas', 'opt')
    op.drop_constraint("chuni_static_events_ibfk_1", "chuni_static_events", type_='foreignkey')
    op.drop_column('chuni_static_events', 'opt')
    op.drop_constraint("chuni_static_charge_ibfk_1", "chuni_static_charge", type_='foreignkey')
    op.drop_column('chuni_static_charge', 'opt')
    op.drop_constraint("chuni_static_character_ibfk_1", "chuni_static_character", type_='foreignkey')
    op.drop_column('chuni_static_character', 'opt')
    op.drop_constraint("chuni_static_cards_ibfk_1", "chuni_static_cards", type_='foreignkey')
    op.drop_column('chuni_static_cards', 'opt')
    op.drop_constraint("chuni_static_avatar_ibfk_1", "chuni_static_avatar", type_='foreignkey')
    op.drop_column('chuni_static_avatar', 'opt')
    op.drop_table('ongeki_static_opt')
    op.drop_table('mai2_static_opt')
    op.drop_table('cm_static_opts')
    op.drop_table('chuni_static_opt')
    # ### end Alembic commands ###
