Template
Add DatabaseMiddleware
This commit is contained in:
@@ -2,6 +2,7 @@ from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import DeclarativeBase
|
||||
|
||||
from ..config import DatabaseConfig
|
||||
from .models import User
|
||||
|
||||
|
||||
def get_engine(config: DatabaseConfig):
|
||||
|
||||
@@ -8,5 +8,8 @@ class User (Base):
|
||||
__tablename__ = "user"
|
||||
|
||||
id: Mapped[int] = mapped_column(BIGINT, primary_key=True, unique=True, autoincrement=False)
|
||||
username: Mapped[int] = mapped_column(String(32), unique=True, nullable=True)
|
||||
username: Mapped[str] = mapped_column(String(32), unique=True, nullable=True)
|
||||
# additional fields go here
|
||||
|
||||
def __init__(self, id: int, username: str):
|
||||
super().__init__(id=id, username=username)
|
||||
|
||||
Reference in New Issue
Block a user