Add: Presence model.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
"""File holds all model definitions of SQL tables."""
|
"""File holds all model definitions of SQL tables."""
|
||||||
|
|
||||||
from sqlalchemy.dialects.mysql import BIGINT, VARCHAR
|
from sqlalchemy.dialects.mysql import BIGINT, INTEGER, VARCHAR
|
||||||
from sqlmodel import Column, Field, ForeignKey, Relationship, SQLModel
|
from sqlmodel import Column, Field, ForeignKey, Relationship, SQLModel
|
||||||
|
|
||||||
|
|
||||||
@@ -131,3 +131,18 @@ class UserBirthday(SQLModel, table=True):
|
|||||||
# TODO(imcompiling): split into month and day. Also relies on Alembic migration.
|
# TODO(imcompiling): split into month and day. Also relies on Alembic migration.
|
||||||
# https://gitea.cheezers.org/imcompiling/dakiny-bot/issues/93
|
# https://gitea.cheezers.org/imcompiling/dakiny-bot/issues/93
|
||||||
birthday: str = Field(sa_column=Column("Birthday", VARCHAR, nullable=False), max_length=5)
|
birthday: str = Field(sa_column=Column("Birthday", VARCHAR, nullable=False), max_length=5)
|
||||||
|
|
||||||
|
|
||||||
|
class Presence(SQLModel, table=True):
|
||||||
|
"""
|
||||||
|
Stores presences for the bot to pull and use.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
id: Auto-incremented id for each entry.
|
||||||
|
presence: The presence itself.
|
||||||
|
"""
|
||||||
|
|
||||||
|
__tablename__: str = "Presences"
|
||||||
|
|
||||||
|
id: int | None = Field(sa_column=Column("Id", INTEGER, primary_key=True), default=None)
|
||||||
|
presence: str = Field(sa_column=Column("Presence", VARCHAR, nullable=False), max_length=100)
|
||||||
|
|||||||
Reference in New Issue
Block a user