Automated Action 4bbc49f04d Create a FastAPI REST API service with SQLite database
- Set up project structure
- Configure SQLite database with SQLAlchemy
- Create item model and schema
- Set up Alembic for database migrations
- Implement CRUD operations for items
- Add health check endpoint
- Add API documentation
- Configure Ruff for linting
- Update README with project information
2025-05-23 09:14:12 +00:00

20 lines
623 B
Python

from sqlalchemy import Boolean, Column, DateTime, Integer, String, Text
from sqlalchemy.sql import func
from app.db.base_class import Base
class Item(Base):
"""
Item model for storing item data
"""
id = Column(Integer, primary_key=True, index=True)
title = Column(String(255), nullable=False, index=True)
description = Column(Text, nullable=True)
is_active = Column(Boolean, default=True)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(
DateTime(timezone=True),
server_default=func.now(),
onupdate=func.now(),
)