feat: add first_name, last_name, display_name, avatar_url to User model

Add 4 new nullable profile fields to support the upcoming account
management (Kontoverwaltung) feature. Includes Alembic migration
that has been applied to production database.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
CCS Admin 2026-02-26 09:34:33 +00:00
parent 400520aebd
commit d09fdccc75
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,32 @@
"""add profile fields to users
Revision ID: 5717043d0f9d
Revises: 062ccae5457b
Create Date: 2026-02-26 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "5717043d0f9d"
down_revision: Union[str, None] = "062ccae5457b"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.add_column("users", sa.Column("first_name", sa.String(100), nullable=True))
op.add_column("users", sa.Column("last_name", sa.String(100), nullable=True))
op.add_column("users", sa.Column("display_name", sa.String(200), nullable=True))
op.add_column("users", sa.Column("avatar_url", sa.String(500), nullable=True))
def downgrade() -> None:
op.drop_column("users", "avatar_url")
op.drop_column("users", "display_name")
op.drop_column("users", "last_name")
op.drop_column("users", "first_name")

View file

@ -28,6 +28,10 @@ class User(Base):
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True) id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
username: Mapped[str] = mapped_column(String(100), nullable=False) username: Mapped[str] = mapped_column(String(100), nullable=False)
email: Mapped[str] = mapped_column(String(255), nullable=False) email: Mapped[str] = mapped_column(String(255), nullable=False)
first_name: Mapped[Optional[str]] = mapped_column(String(100), nullable=True)
last_name: Mapped[Optional[str]] = mapped_column(String(100), nullable=True)
display_name: Mapped[Optional[str]] = mapped_column(String(200), nullable=True)
avatar_url: Mapped[Optional[str]] = mapped_column(String(500), nullable=True)
password_hash: Mapped[str] = mapped_column(String(255), nullable=False) password_hash: Mapped[str] = mapped_column(String(255), nullable=False)
role: Mapped[str] = mapped_column( role: Mapped[str] = mapped_column(
String(20), nullable=False, server_default="dak_mitarbeiter" String(20), nullable=False, server_default="dak_mitarbeiter"