Files
Kavosh/app/models/log_file.py
T
2026-08-07 21:17:17 +03:30

23 lines
979 B
Python

"""LogFile model (Chapter 06)."""
from __future__ import annotations
from datetime import datetime
from app.extensions import db
class LogFile(db.Model):
__tablename__ = "log_files"
id: int = db.Column(db.Integer, primary_key=True)
filename: str = db.Column(db.String(255), nullable=False)
server_type: str = db.Column(db.String(16), nullable=False) # apache|litespeed
format_string: str = db.Column(db.Text, nullable=False)
uploaded_at: datetime = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
status: str = db.Column(db.String(16), nullable=False, default="queued")
total_lines: int | None = db.Column(db.Integer, nullable=True)
processed_lines: int = db.Column(db.Integer, nullable=False, default=0)
size_bytes: int = db.Column(db.BigInteger, nullable=False)
checksum: str = db.Column(db.String(64), nullable=False, index=True) # sha256 hex
error_message: str | None = db.Column(db.Text, nullable=True)