maybe good
This commit is contained in:
17
app/models/base.py
Normal file
17
app/models/base.py
Normal file
@@ -0,0 +1,17 @@
|
||||
"""
|
||||
Base model with common fields
|
||||
"""
|
||||
from sqlalchemy import Column, DateTime, String
|
||||
from sqlalchemy.sql import func
|
||||
from app.database.base import Base
|
||||
|
||||
|
||||
class TimestampMixin:
|
||||
"""Mixin for created_at and updated_at timestamps"""
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
||||
|
||||
|
||||
class BaseModel(Base, TimestampMixin):
|
||||
"""Base model class"""
|
||||
__abstract__ = True
|
||||
Reference in New Issue
Block a user