feat(factory): implement db-backed dashboard and workflow automation refs NOISSUE
This commit is contained in:
@@ -10,7 +10,10 @@ from sqlalchemy import (
|
||||
)
|
||||
from sqlalchemy.orm import relationship, declarative_base
|
||||
|
||||
from config import settings
|
||||
try:
|
||||
from .config import settings
|
||||
except ImportError:
|
||||
from config import settings
|
||||
|
||||
Base = declarative_base()
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -52,6 +55,7 @@ class ProjectHistory(Base):
|
||||
ui_snapshots = relationship("UISnapshot", back_populates="project_history", cascade="all, delete-orphan")
|
||||
pull_requests = relationship("PullRequest", back_populates="project_history", cascade="all, delete-orphan")
|
||||
pull_request_data = relationship("PullRequestData", back_populates="project_history", cascade="all, delete-orphan")
|
||||
prompt_code_links = relationship("PromptCodeLink", back_populates="project_history", cascade="all, delete-orphan")
|
||||
|
||||
|
||||
class ProjectLog(Base):
|
||||
@@ -145,6 +149,22 @@ class AuditTrail(Base):
|
||||
metadata_json = Column(JSON, nullable=True)
|
||||
|
||||
|
||||
class PromptCodeLink(Base):
|
||||
"""Explicit lineage between a prompt event and a resulting code change."""
|
||||
__tablename__ = "prompt_code_links"
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
history_id = Column(Integer, ForeignKey("project_history.id"), nullable=False)
|
||||
project_id = Column(String(255), nullable=False)
|
||||
prompt_audit_id = Column(Integer, nullable=False)
|
||||
code_change_audit_id = Column(Integer, nullable=False)
|
||||
file_path = Column(String(500), nullable=True)
|
||||
change_type = Column(String(50), nullable=True)
|
||||
created_at = Column(DateTime, default=datetime.utcnow)
|
||||
|
||||
project_history = relationship("ProjectHistory", back_populates="prompt_code_links")
|
||||
|
||||
|
||||
class UserAction(Base):
|
||||
"""User action audit entries."""
|
||||
__tablename__ = "user_actions"
|
||||
|
||||
Reference in New Issue
Block a user