mirror of
https://github.com/mblanke/ThreatHunt.git
synced 2026-03-01 14:00:20 -05:00
20 lines
669 B
Python
20 lines
669 B
Python
from sqlalchemy import Column, Integer, String, DateTime
|
|
from sqlalchemy.orm import relationship
|
|
from datetime import datetime, timezone
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class Tenant(Base):
|
|
__tablename__ = "tenants"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String, unique=True, index=True, nullable=False)
|
|
description = Column(String, nullable=True)
|
|
created_at = Column(DateTime, default=lambda: datetime.now(timezone.utc))
|
|
|
|
# Relationships
|
|
users = relationship("User", back_populates="tenant")
|
|
hosts = relationship("Host", back_populates="tenant")
|
|
cases = relationship("Case", back_populates="tenant")
|