"""Mai2 PRiSM support

Revision ID: 5cf98cfe52ad
Revises: 263884e774cc
Create Date: 2025-04-08 08:00:51.243089

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('mai2_score_kaleidxscope',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user', sa.Integer(), nullable=False),
    sa.Column('gateId', sa.Integer(), nullable=True),
    sa.Column('isGateFound', sa.Boolean(), nullable=True),
    sa.Column('isKeyFound', sa.Boolean(), nullable=True),
    sa.Column('isClear', sa.Boolean(), nullable=True),
    sa.Column('totalRestLife', sa.Integer(), nullable=True),
    sa.Column('totalAchievement', sa.Integer(), nullable=True),
    sa.Column('totalDeluxscore', sa.Integer(), nullable=True),
    sa.Column('bestAchievement', sa.Integer(), nullable=True),
    sa.Column('bestDeluxscore', sa.Integer(), nullable=True),
    sa.Column('bestAchievementDate', sa.String(length=25), nullable=True),
    sa.Column('bestDeluxscoreDate', sa.String(length=25), nullable=True),
    sa.Column('playCount', sa.Integer(), nullable=True),
    sa.Column('clearDate', sa.String(length=25), nullable=True),
    sa.Column('lastPlayDate', sa.String(length=25), nullable=True),
    sa.Column('isInfoWatched', sa.Boolean(), nullable=True),
    sa.ForeignKeyConstraint(['user'], ['aime_user.id'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('user', 'gateId', name='mai2_score_best_uk'),
    mysql_charset='utf8mb4'
    )
    op.add_column('mai2_playlog', sa.Column('extBool2', sa.Boolean(), nullable=True, server_default=sa.text("NULL")))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('mai2_playlog', 'extBool2')
    op.drop_table('mai2_score_kaleidxscope')
    # ### end Alembic commands ###
