Add backend/app/models/workspace.py
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
"""Workspace model."""
|
||||||
|
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime, Text
|
||||||
|
from sqlalchemy.orm import relationship
|
||||||
|
from datetime import datetime
|
||||||
|
from app.database import Base
|
||||||
|
|
||||||
|
class Workspace(Base):
|
||||||
|
"""Workspace model."""
|
||||||
|
__tablename__ = "workspaces"
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
|
name = Column(String(255), nullable=False)
|
||||||
|
description = Column(Text)
|
||||||
|
owner_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||||||
|
created_at = Column(DateTime, default=datetime.utcnow)
|
||||||
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||||
|
|
||||||
|
owner = relationship("User", back_populates="workspaces")
|
||||||
|
tables = relationship("Table", back_populates="workspace")
|
||||||
Reference in New Issue
Block a user