"""post type images

Revision ID: 110d7ef78907
Revises: dbd0c7339d69
Create Date: 2025-07-21 14:42:44.737951

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '110d7ef78907'
down_revision: Union[str, None] = 'dbd0c7339d69'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('post_images',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('post_id', sa.Integer(), nullable=True),
    sa.Column('post_type_id', sa.Integer(), nullable=True),
    sa.Column('image_url', sa.String(), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['post_id'], ['calendar_posts.id'], ),
    sa.ForeignKeyConstraint(['post_type_id'], ['calendar_post_types.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_post_images_id'), 'post_images', ['id'], unique=False)
    op.drop_column('calendar_post_types', 'images')
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('calendar_post_types', sa.Column('images', sa.VARCHAR(), autoincrement=False, nullable=True))
    op.drop_index(op.f('ix_post_images_id'), table_name='post_images')
    op.drop_table('post_images')
    # ### end Alembic commands ###
