From 936177fb376b06f3b3eff425b4ec7987c6857cbd Mon Sep 17 00:00:00 2001 From: Leopoldadmin Date: Tue, 9 Jun 2026 23:30:05 +0000 Subject: [PATCH] Add backend/app/models/workspace.py --- backend/app/models/workspace.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 backend/app/models/workspace.py diff --git a/backend/app/models/workspace.py b/backend/app/models/workspace.py new file mode 100644 index 0000000..a6f6ee6 --- /dev/null +++ b/backend/app/models/workspace.py @@ -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")