You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1013 B
Python
31 lines
1013 B
Python
"""
|
|
Overlay job log — tracks scheduler runs of the headline collector.
|
|
"""
|
|
|
|
from sqlalchemy import Column, String, Index, Integer, Text
|
|
from sqlalchemy.dialects.postgresql import UUID, TIMESTAMP
|
|
from datetime import datetime, timezone
|
|
import uuid
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class OverlayJobLog(Base):
|
|
__tablename__ = "overlay_job_log"
|
|
|
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
job_type = Column(String(50), nullable=False)
|
|
status = Column(String(20), nullable=False)
|
|
started_at = Column(TIMESTAMP(timezone=True), nullable=False)
|
|
completed_at = Column(TIMESTAMP(timezone=True), nullable=True)
|
|
records_processed = Column(Integer, default=0)
|
|
error_message = Column(Text, nullable=True)
|
|
created_at = Column(
|
|
TIMESTAMP(timezone=True), default=lambda: datetime.now(timezone.utc)
|
|
)
|
|
|
|
__table_args__ = (
|
|
Index("idx_overlay_job_log_type", "job_type"),
|
|
Index("idx_overlay_job_log_started_at", "started_at"),
|
|
)
|