WIP: created Project and Environment models
This commit is contained in:
@@ -11,3 +11,5 @@ from .workspace_role import WorkspaceRole
|
||||
from .pe_number import PENumber
|
||||
from .task_order import TaskOrder
|
||||
from .workspace import Workspace
|
||||
from .project import Project
|
||||
from .environment import Environment
|
||||
|
16
atst/models/environment.py
Normal file
16
atst/models/environment.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from sqlalchemy import Column, ForeignKey, String
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from atst.models import Base
|
||||
from atst.models.types import Id
|
||||
from atst.models.mixins import TimestampsMixin
|
||||
|
||||
|
||||
class Environment(Base, TimestampsMixin):
|
||||
__tablename__ = "environments"
|
||||
|
||||
id = Id()
|
||||
name = Column(String, nullable=False)
|
||||
|
||||
project_id = Column(ForeignKey("projects.id"))
|
||||
project = relationship("Project")
|
18
atst/models/project.py
Normal file
18
atst/models/project.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from sqlalchemy import Column, ForeignKey, String
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from atst.models import Base
|
||||
from atst.models.types import Id
|
||||
from atst.models.mixins import TimestampsMixin
|
||||
|
||||
|
||||
class Project(Base, TimestampsMixin):
|
||||
__tablename__ = "projects"
|
||||
|
||||
id = Id()
|
||||
name = Column(String, nullable=False)
|
||||
description = Column(String, nullable=False)
|
||||
|
||||
workspace_id = Column(ForeignKey("workspaces.id"), nullable=False)
|
||||
workspace = relationship("Workspace")
|
||||
projects = relationship("Environment", back_populates="project")
|
@@ -10,11 +10,11 @@ class Workspace(Base, TimestampsMixin):
|
||||
__tablename__ = "workspaces"
|
||||
|
||||
id = Id()
|
||||
name = Column(String, unique=True)
|
||||
|
||||
request_id = Column(ForeignKey("requests.id"), nullable=False)
|
||||
request = relationship("Request")
|
||||
|
||||
name = Column(String, unique=True)
|
||||
projects = relationship("Project", back_populates="workspace")
|
||||
|
||||
@property
|
||||
def owner(self):
|
||||
|
Reference in New Issue
Block a user