"""recreate tcgplayer price history

Revision ID: 9fb73424598c
Revises: 7f309a891094
Create Date: 2025-04-17 23:13:55.027126

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision: str = '9fb73424598c'
down_revision: Union[str, None] = '7f309a891094'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tcgplayer_price_history',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('product_id', sa.Integer(), nullable=True),
    sa.Column('date', sa.DateTime(), nullable=True),
    sa.Column('low_price', sa.Float(), nullable=True),
    sa.Column('mid_price', sa.Float(), nullable=True),
    sa.Column('high_price', sa.Float(), nullable=True),
    sa.Column('market_price', sa.Float(), nullable=True),
    sa.Column('direct_low_price', sa.Float(), nullable=True),
    sa.Column('sub_type_name', sa.String(), nullable=True),
    sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
    sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_tcgplayer_price_history_id'), 'tcgplayer_price_history', ['id'], unique=False)
    op.create_index(op.f('ix_tcgplayer_price_history_product_id'), 'tcgplayer_price_history', ['product_id'], unique=False)
    op.create_index(op.f('ix_tcgplayer_price_history_date'), 'tcgplayer_price_history', ['date'], unique=False)
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_tcgplayer_price_history_date'), table_name='tcgplayer_price_history')
    op.drop_index(op.f('ix_tcgplayer_price_history_product_id'), table_name='tcgplayer_price_history')
    op.drop_index(op.f('ix_tcgplayer_price_history_id'), table_name='tcgplayer_price_history')
    op.drop_table('tcgplayer_price_history')
    # ### end Alembic commands ###
