"""mai2_add_photos

Revision ID: d8cd1fa04c2a
Revises: 54a84103b84e
Create Date: 2024-10-06 03:09:15.959817

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

# revision identifiers, used by Alembic.
revision = 'd8cd1fa04c2a'
down_revision = '54a84103b84e'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('mai2_user_photo',
    sa.Column('id', sa.VARCHAR(length=36), nullable=False),
    sa.Column('user', sa.Integer(), nullable=False),
    sa.Column('playlog_num', sa.INTEGER(), nullable=False),
    sa.Column('track_num', sa.INTEGER(), nullable=False),
    sa.Column('when_upload', sa.TIMESTAMP(), server_default=sa.text('now()'), nullable=False),
    sa.ForeignKeyConstraint(['user'], ['aime_user.id'], onupdate='cascade', ondelete='cascade'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('user', 'playlog_num', 'track_num', name='mai2_user_photo_uk'),
    mysql_charset='utf8mb4'
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('mai2_user_photo')
    # ### end Alembic commands ###
