Spaces:
Runtime error
Runtime error
Download app/models/posts.py from abdullah090809/FastAPI-Project: direct link, hf CLI and curl.
- Browser
- Download file 643 Bytes
-
https://huggingface.co/spaces/abdullah090809/FastAPI-Project/resolve/bb4b25f33972753e5ff545649133e43bf2aeb752/app/models/posts.py
- Command line
-
hf download hf://spaces/abdullah090809/FastAPI-Project@bb4b25f33972753e5ff545649133e43bf2aeb752/app/models/posts.py
-
curl -L -o posts.py https://huggingface.co/spaces/abdullah090809/FastAPI-Project/resolve/bb4b25f33972753e5ff545649133e43bf2aeb752/app/models/posts.py
643 Bytes
| from sqlalchemy import Column, ForeignKey, Integer, String, Boolean, TIMESTAMP, text | |
| from sqlalchemy.orm import relationship | |
| from app.database import Base | |
| class Post(Base): | |
| __tablename__ = "posts" | |
| id = Column(Integer, primary_key=True, nullable=False) | |
| title = Column(String, nullable=False) | |
| content = Column(String, nullable=False) | |
| published = Column(Boolean, server_default="TRUE", nullable=False) | |
| created_at = Column(TIMESTAMP(timezone=True), nullable=False, server_default=text("now()")) | |
| owner_id = Column(Integer, ForeignKey("users.id",ondelete="CASCADE"),nullable=False) | |
| owner = relationship("User") | |