Files
2026-08-07 21:17:17 +03:30

23 lines
850 B
Python

"""bot_hits table (Chapter 06) — SEO section (Ch09)."""
from __future__ import annotations
from app.extensions import db
class BotHit(db.Model):
__tablename__ = "bot_hits"
id: int = db.Column(db.Integer, primary_key=True)
log_file_id: int = db.Column(db.Integer, db.ForeignKey("log_files.id", ondelete="CASCADE"), nullable=False)
timestamp = db.Column(db.DateTime, nullable=False)
ip: str = db.Column(db.String(45), nullable=False)
bot_name: str = db.Column(db.String(64), nullable=False)
verified: bool = db.Column(db.Boolean, nullable=False, default=False)
path: str = db.Column(db.Text, nullable=False)
status_code: int = db.Column(db.SmallInteger, nullable=False)
__table_args__ = (
db.Index("ix_bot_hits_timestamp", "timestamp"),
db.Index("ix_bot_hits_bot_name", "bot_name"),
)