fix: align index name between model and migration, drop unused import

Use explicit Index() in __table_args__ matching the migration's
'memory_user_id_idx' name (consistent with chats.py / tags.py /
chat_messages.py). Avoids autogenerate churn from SQLAlchemy's
default ix_memory_user_id name. Also drops the unused sqlalchemy
import from the migration.
This commit is contained in:
Claude 2026-04-17 07:59:33 +00:00
parent f8b39eed19
commit d9bcb26154
No known key found for this signature in database
2 changed files with 6 additions and 3 deletions

View file

@ -7,7 +7,6 @@ Create Date: 2026-04-17 00:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
revision = 'a749ab2aa953'
down_revision = 'c1d2e3f4a5b6'

View file

@ -6,7 +6,7 @@ from sqlalchemy import select, delete
from sqlalchemy.ext.asyncio import AsyncSession
from open_webui.internal.db import Base, get_async_db_context
from pydantic import BaseModel, ConfigDict
from sqlalchemy import BigInteger, Column, String, Text
from sqlalchemy import BigInteger, Column, Index, String, Text
####################
# Memory DB Schema
@ -19,11 +19,15 @@ class Memory(Base):
__tablename__ = 'memory'
id = Column(String, primary_key=True, unique=True)
user_id = Column(String, index=True)
user_id = Column(String)
content = Column(Text)
updated_at = Column(BigInteger)
created_at = Column(BigInteger)
__table_args__ = (
Index('memory_user_id_idx', 'user_id'),
)
class MemoryModel(BaseModel):
id: str