"""202603051440

Revision ID: 6a4641cf192b
Revises: b4af97639217
Create Date: 2026-03-05 14:41:03.371557

"""
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 = '6a4641cf192b'
down_revision: Union[str, None] = 'b4af97639217'
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('implicit_emotions_storage',
    sa.Column('id', sa.UUID(), nullable=False, comment='主键ID'),
    sa.Column('end_user_id', sa.String(length=255), nullable=False, comment='终端用户ID'),
    sa.Column('implicit_profile', postgresql.JSONB(astext_type=sa.Text()), nullable=True, comment='隐性记忆用户画像数据'),
    sa.Column('emotion_suggestions', postgresql.JSONB(astext_type=sa.Text()), nullable=True, comment='情绪个性化建议数据'),
    sa.Column('created_at', sa.DateTime(), nullable=False, comment='创建时间'),
    sa.Column('updated_at', sa.DateTime(), nullable=False, comment='更新时间'),
    sa.Column('implicit_generated_at', sa.DateTime(), nullable=True, comment='隐性记忆画像生成时间'),
    sa.Column('emotion_generated_at', sa.DateTime(), nullable=True, comment='情绪建议生成时间'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('end_user_id')
    )
    op.create_index('idx_updated_at', 'implicit_emotions_storage', ['updated_at'], unique=False)
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('idx_updated_at', table_name='implicit_emotions_storage')
    op.drop_table('implicit_emotions_storage')
    # ### end Alembic commands ###
