Files
DataClaw/backend/app/models/project.py
T

17 lines
707 B
Python
Raw Normal View History

2026-03-16 16:12:35 +08:00
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, func
from sqlalchemy.orm import relationship
from app.database import Base
class Project(Base):
__tablename__ = "projects"
id = Column(Integer, primary_key=True, index=True)
name = Column(String, nullable=False)
description = Column(String, nullable=True)
owner_id = Column(Integer, ForeignKey("users.id"), nullable=False)
created_at = Column(DateTime, default=func.now())
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())
owner = relationship("User", back_populates="projects")
data_sources = relationship("DataSource", back_populates="project", cascade="all, delete-orphan")