Spaces:
Sleeping
Sleeping
| """Document model for SQLite database""" | |
| from sqlalchemy import Column, Integer, String, Text, DateTime | |
| from sqlalchemy.sql import func | |
| from app.db.database import Base | |
| class Document(Base): | |
| """Document metadata model | |
| Stores information about uploaded documents. | |
| The actual text chunks and embeddings are stored in ChromaDB. | |
| """ | |
| __tablename__ = "documents" | |
| document_id = Column(Integer, primary_key=True, autoincrement=True, index=True) | |
| user_id = Column(Integer, nullable=False, index=True) | |
| file_name = Column(String(255), nullable=False) | |
| file_path = Column(Text, nullable=False) | |
| chunk_count = Column(Integer, default=0) | |
| created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False) | |
| def __repr__(self): | |
| return f"<Document(id={self.document_id}, file_name='{self.file_name}', user_id={self.user_id})>" | |