From 1535d908428601a6d842f8c35cea958762bc04e8 Mon Sep 17 00:00:00 2001 From: ramforth Date: Mon, 17 Nov 2025 14:23:54 +0100 Subject: [PATCH] Still updating database schemas --- models.py | 13 ++++++++++++- schemas.py | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/models.py b/models.py index e53f66e..57ac04b 100644 --- a/models.py +++ b/models.py @@ -16,6 +16,7 @@ class User(Base): encrypted_tokens = Column(Text, nullable=False) settings = relationship("Setting", back_populates="owner", uselist=False) + custom_themes = relationship("CustomTheme", back_populates="owner") class Setting(Base): __tablename__ = "settings" @@ -25,4 +26,14 @@ class Setting(Base): overlay_theme = Column(String, default="dark-purple") user_id = Column(Integer, ForeignKey("users.id")) - owner = relationship("User", back_populates="settings") \ No newline at end of file + owner = relationship("User", back_populates="settings") + +class CustomTheme(Base): + __tablename__ = "custom_themes" + + id = Column(Integer, primary_key=True, index=True) + name = Column(String, nullable=False) + css_content = Column(Text, nullable=False) + owner_id = Column(Integer, ForeignKey("users.id"), nullable=False) + + owner = relationship("User", back_populates="custom_themes") \ No newline at end of file diff --git a/schemas.py b/schemas.py index 943def8..768d40a 100644 --- a/schemas.py +++ b/schemas.py @@ -16,4 +16,4 @@ class CustomTheme(CustomThemeBase): class Config: # This allows the Pydantic model to be created from a SQLAlchemy ORM object - orm_mode = True \ No newline at end of file + from_attributes = True \ No newline at end of file