12 lines
512 B
Python
12 lines
512 B
Python
from sqlalchemy import Column, Integer, String, ForeignKey
|
|
from sqlalchemy.orm import relationship
|
|
from app.api.db.database import Base
|
|
class And(Base):
|
|
__tablename__ = "ands"
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String)
|
|
content = Column(String)
|
|
post_id = Column(Integer, ForeignKey("posts.id"))
|
|
post = relationship("Post", back_populates="ands")
|
|
author_id = Column(Integer, ForeignKey("users.id"))
|
|
author = relationship("User", back_populates="ands") |