forum-app/backend/models.py

22 lines
556 B
Python
Raw Normal View History

2024-04-01 04:43:12 +00:00
from database import Base
from sqlalchemy import Column, Integer, String, Boolean, ForeignKey
class Posts(Base):
__tablename__ = 'posts'
id = Column(Integer, primary_key=True)
thread_id = Column(Integer, ForeignKey("threads.id"))
author = Column(String)
title = Column(String)
content = Column(String)
class Threads(Base):
__tablename__ = 'threads'
id = Column(Integer, primary_key=True)
author = Column(String)
title = Column(String)
2024-04-01 21:26:01 +00:00
content = Column(String)
is_closed = Column(Boolean, default=False)