"""drop activitylog table

Revision ID: f9012gh3456
Revises: e8901fg2345
Create Date: 2025-01-17 13:00:00.000000

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


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


def upgrade() -> None:
    """
    Drop Activitylog table (unused - data is stored in activity_interval instead)
    """
    conn = op.get_bind()
    inspector = sa.inspect(conn)
    tables = inspector.get_table_names()
    
    if 'Activitylog' in tables:
        op.drop_table('Activitylog')


def downgrade() -> None:
    """
    Recreate Activitylog table (if needed for rollback)
    """
    op.create_table('Activitylog',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('request_data', sa.JSON(), nullable=True),
        sa.Column('is_uploaded', sa.Boolean(), nullable=True),
        sa.Column('start_time', sa.DateTime(), nullable=True),
        sa.Column('end_time', sa.DateTime(), nullable=True),
        sa.Column('timestamp', sa.DateTime(), nullable=True),
        sa.PrimaryKeyConstraint('id')
    )

