15 lines
392 B
Python
15 lines
392 B
Python
from datetime import datetime
|
|
|
|
from sqlalchemy import Column, DateTime
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class TimestampMixin:
|
|
"""Mixin to add created_at and updated_at timestamps to models"""
|
|
|
|
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
updated_at = Column(
|
|
DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False
|
|
)
|