Spaces:
Sleeping
Sleeping
File size: 554 Bytes
f92858b 81ec8d6 d5684b3 f92858b 81ec8d6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from datetime import datetime, timezone
from sqlalchemy import DateTime
from sqlalchemy.orm import Mapped, mapped_column
from app.engine.postgresdb import Base
class BaseModel:
id: Mapped[int] = mapped_column(primary_key=True, index=True, autoincrement=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=datetime.now(timezone.utc))
updated_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True),
default=datetime.now(timezone.utc),
onupdate=datetime.now(timezone.utc),
)
|