
- Set up project structure with FastAPI - Configure SQLite database with SQLAlchemy - Set up Alembic for migrations - Create Item model and schema - Implement CRUD operations - Add health endpoint generated with BackendIM... (backend.im)
13 lines
479 B
Python
13 lines
479 B
Python
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.db.base_class import Base
|
|
|
|
|
|
class Item(Base):
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String(255), index=True)
|
|
description = Column(Text, nullable=True)
|
|
is_active = Column(Boolean, default=True)
|
|
created_at = Column(DateTime, default=func.now())
|
|
updated_at = Column(DateTime, default=func.now(), onupdate=func.now()) |