-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
23 lines (19 loc) · 909 Bytes
/
Copy pathmodels.py
File metadata and controls
23 lines (19 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from sqlalchemy import Column, Integer, String, DateTime, Text
from sqlalchemy.sql import func
from database import Base
class Agent(Base):
__tablename__ = "agents"
id = Column(Integer, primary_key=True, index=True)
name = Column(String(100), unique=True, nullable=False)
type = Column(String(50), nullable=False)
status = Column(String(20), nullable=False, default="stopped")
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
class StatusLog(Base):
__tablename__ = "status_logs"
id = Column(Integer, primary_key=True, index=True)
agent_id = Column(Integer, nullable=False)
old_status = Column(String(20))
new_status = Column(String(20), nullable=False)
note = Column(Text, nullable=True)
changed_at = Column(DateTime(timezone=True), server_default=func.now())