This repository has been archived on 2025-09-07. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
MouseyBot/Mousey/Database/Models/base.py

18 lines
644 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from sqlalchemy import DateTime, func
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
class Base(DeclarativeBase):
"""
Основной шаблон для схем в базе данных.
"""
# Информация о том, когда была добавлена строка в БД
added: Mapped[DateTime] = mapped_column(
DateTime, default=func.now()
)
# Информация о том, когда последний раз была обновлена строчка
updated: Mapped[DateTime] = mapped_column(
DateTime, default=func.now(), onupdate=func.now()
)