"""add_event_log_game_version

Revision ID: 2d024cf145a1
Revises: 2bf9f38d9444
Create Date: 2024-05-21 23:41:31.445331

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

# revision identifiers, used by Alembic.
revision = '2d024cf145a1'
down_revision = '2bf9f38d9444'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('event_log', sa.Column('game', sa.TEXT(length=4), nullable=True))
    op.add_column('event_log', sa.Column('version', sa.TEXT(length=24), nullable=True))
    op.alter_column('event_log', 'ip',
               existing_type=mysql.TINYTEXT(),
               type_=sa.TEXT(length=39),
               existing_nullable=True)
    op.alter_column('event_log', 'when_logged',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('now()'),
               existing_nullable=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('event_log', 'when_logged',
               existing_type=mysql.TIMESTAMP(),
               server_default=sa.text('current_timestamp()'),
               existing_nullable=False)
    op.alter_column('event_log', 'ip',
               existing_type=sa.TEXT(length=39),
               type_=mysql.TINYTEXT(),
               existing_nullable=True)
    op.drop_column('event_log', 'version')
    op.drop_column('event_log', 'game')
    # ### end Alembic commands ###
