Automated Action 629ba0ee1c Create REST API with FastAPI and SQLite
- Set up project structure with FastAPI app
- Implement SQLAlchemy models and async database connection
- Create CRUD endpoints for items resource
- Add health endpoint for monitoring
- Configure Alembic for database migrations
- Create comprehensive documentation

generated with BackendIM... (backend.im)
2025-05-15 15:49:28 +00:00

12 lines
485 B
Python

from sqlalchemy import Column, Integer, String, Text, DateTime
from sqlalchemy.sql import func
from app.db.database import Base
class Item(Base):
__tablename__ = "items"
id = Column(Integer, primary_key=True, index=True)
name = Column(String(100), nullable=False, index=True)
description = Column(Text, nullable=True)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())