15 lines
428 B
Python
15 lines
428 B
Python
"""Base model with common fields."""
|
|
|
|
from datetime import datetime
|
|
from sqlalchemy import Column, DateTime, Integer
|
|
from sqlalchemy.orm import declarative_base
|
|
|
|
Base = declarative_base()
|
|
|
|
|
|
class TimestampMixin:
|
|
"""Mixin for timestamp columns."""
|
|
|
|
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
|