"""add reasoning and citations_json to sentiment_scores, unavailable_fields_json to fundamental_data

Revision ID: 002
Revises: 001
Create Date: 2025-01-02 00:00:00.000000

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = "002"
down_revision: Union[str, None] = "001"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.add_column(
        "sentiment_scores",
        sa.Column("reasoning", sa.Text(), server_default="", nullable=False),
    )
    op.add_column(
        "sentiment_scores",
        sa.Column("citations_json", sa.Text(), server_default="[]", nullable=False),
    )
    op.add_column(
        "fundamental_data",
        sa.Column(
            "unavailable_fields_json", sa.Text(), server_default="{}", nullable=False
        ),
    )


def downgrade() -> None:
    op.drop_column("fundamental_data", "unavailable_fields_json")
    op.drop_column("sentiment_scores", "citations_json")
    op.drop_column("sentiment_scores", "reasoning")
