"""fix_memory

迁移 ID: 1d99948099bb
父迁移: 3537b7cb6a29
创建时间: 2025-08-16 18:08:27.480805

"""

from __future__ import annotations

from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op

revision: str = "1d99948099bb"
down_revision: str | Sequence[str] | None = "3537b7cb6a29"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade(name: str = "") -> None:
    if name:
        return
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("suggarchat_memory_data", schema=None) as batch_op:
        batch_op.add_column(sa.Column("memory_json", sa.Text(), nullable=False))
        batch_op.drop_column("messages_json")

    # ### end Alembic commands ###


def downgrade(name: str = "") -> None:
    if name:
        return
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("suggarchat_memory_data", schema=None) as batch_op:
        batch_op.add_column(sa.Column("messages_json", sa.TEXT(), nullable=False))
        batch_op.drop_column("memory_json")

    # ### end Alembic commands ###
