生成新engine
This commit is contained in:
12
db/models.py
12
db/models.py
@@ -33,11 +33,15 @@ class Camera(Base):
|
||||
__tablename__ = "cameras"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
cloud_id: Mapped[Optional[int]] = mapped_column(Integer, unique=True, nullable=True)
|
||||
name: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
rtsp_url: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
enabled: Mapped[bool] = mapped_column(Boolean, default=True)
|
||||
fps_limit: Mapped[int] = mapped_column(Integer, default=30)
|
||||
process_every_n_frames: Mapped[int] = mapped_column(Integer, default=3)
|
||||
pending_sync: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
sync_failed_at: Mapped[Optional[datetime]] = mapped_column(DateTime)
|
||||
sync_retry_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime, default=datetime.utcnow, onupdate=datetime.utcnow
|
||||
@@ -74,6 +78,7 @@ class ROI(Base):
|
||||
__tablename__ = "rois"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
cloud_id: Mapped[Optional[int]] = mapped_column(Integer, unique=True, nullable=True)
|
||||
camera_id: Mapped[int] = mapped_column(
|
||||
Integer, ForeignKey("cameras.id"), nullable=False
|
||||
)
|
||||
@@ -88,6 +93,8 @@ class ROI(Base):
|
||||
threshold_sec: Mapped[int] = mapped_column(Integer, default=360)
|
||||
confirm_sec: Mapped[int] = mapped_column(Integer, default=30)
|
||||
return_sec: Mapped[int] = mapped_column(Integer, default=5)
|
||||
pending_sync: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
sync_version: Mapped[int] = mapped_column(Integer, default=0)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime, default=datetime.utcnow, onupdate=datetime.utcnow
|
||||
@@ -100,6 +107,7 @@ class Alarm(Base):
|
||||
__tablename__ = "alarms"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
cloud_id: Mapped[Optional[int]] = mapped_column(Integer, nullable=True)
|
||||
camera_id: Mapped[int] = mapped_column(
|
||||
Integer, ForeignKey("cameras.id"), nullable=False
|
||||
)
|
||||
@@ -107,6 +115,10 @@ class Alarm(Base):
|
||||
event_type: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
confidence: Mapped[float] = mapped_column(Float, default=0.0)
|
||||
snapshot_path: Mapped[Optional[str]] = mapped_column(Text)
|
||||
region_data: Mapped[Optional[str]] = mapped_column(Text)
|
||||
upload_status: Mapped[str] = mapped_column(String(32), default='pending_upload')
|
||||
upload_retry_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
error_message: Mapped[Optional[str]] = mapped_column(Text)
|
||||
llm_checked: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
llm_result: Mapped[Optional[str]] = mapped_column(Text)
|
||||
processed: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
|
||||
Reference in New Issue
Block a user