-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatabaseSchema.py
More file actions
18 lines (14 loc) · 752 Bytes
/
DatabaseSchema.py
File metadata and controls
18 lines (14 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from sqlalchemy import Integer, DateTime, String
from sqlalchemy.sql import func, null
from sqlalchemy.orm import DeclarativeBase, mapped_column
class Base(DeclarativeBase):
pass
class Ban(Base):
__tablename__ = "bans"
id = mapped_column(Integer, primary_key=True, autoincrement=True)
discord_user_id = mapped_column(String(32), unique=True, nullable=False)
assigner_discord_user_id = mapped_column(String(32), nullable=False)
assigner_discord_user_name = mapped_column(String(32), nullable=False)
created_at = mapped_column(DateTime(), server_default=func.now())
updated_at = mapped_column(DateTime(), server_default=func.now(), onupdate=func.now())
evidence_thread = mapped_column(Integer, nullable=True, server_default=null())