summaryrefslogtreecommitdiff
path: root/src/database/models/comment.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/models/comment.py')
-rw-r--r--src/database/models/comment.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/database/models/comment.py b/src/database/models/comment.py
new file mode 100644
index 0000000..0110e75
--- /dev/null
+++ b/src/database/models/comment.py
@@ -0,0 +1,17 @@
+from sqlalchemy import BigInteger, String, DateTime, Text, ForeignKey
+from sqlalchemy.orm import mapped_column, Mapped, relationship
+from src.database import db
+
+
+class Comment(db.Model):
+ __tablename__ = 'comments'
+
+ id = mapped_column(BigInteger, primary_key=True)
+ content: Mapped[str] = mapped_column(Text)
+ language: Mapped[str] = mapped_column(String(16), nullable=False)
+ email: Mapped[str] = mapped_column(String(256))
+ post: Mapped[str] = mapped_column(String(1024), nullable=False)
+ blog_id: Mapped[int] = mapped_column(ForeignKey('blogs.id'), index=True)
+ blog = relationship('Blog', back_populates='comments')
+ created_at = mapped_column(DateTime)
+ updated_at = mapped_column(DateTime)