23 lines
736 B
Python
23 lines
736 B
Python
from datetime import datetime, timezone
|
|
from sqlalchemy import BigInteger, Column, DateTime, Index, String, Text
|
|
from database.postgres import Base
|
|
|
|
|
|
def _now():
|
|
return datetime.now(timezone.utc)
|
|
|
|
|
|
class MfgAuditLog(Base):
|
|
__tablename__ = "mfg_audit_log"
|
|
__table_args__ = (
|
|
Index("idx_mfg_audit_time", "timestamp"),
|
|
Index("idx_mfg_audit_action", "action"),
|
|
)
|
|
|
|
id = Column(BigInteger, primary_key=True, autoincrement=True)
|
|
timestamp = Column(DateTime(timezone=True), nullable=False, default=_now)
|
|
admin_user = Column(String(256), nullable=False)
|
|
action = Column(String(128), nullable=False)
|
|
serial_number = Column(String(128))
|
|
detail = Column(Text)
|