18 lines
615 B
Python
18 lines
615 B
Python
from sqlalchemy import Boolean, Column, Integer, String, Text
|
|
from sqlalchemy.sql import func
|
|
from sqlalchemy.types import DateTime
|
|
|
|
from app.db.session import Base
|
|
|
|
|
|
class Todo(Base):
|
|
"""SQLAlchemy model for Todo items."""
|
|
|
|
__tablename__ = "todos"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String(255), nullable=False, index=True)
|
|
description = Column(Text, nullable=True)
|
|
completed = Column(Boolean, default=False)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now()) |