feat(l4d2-web): add hostname column to Server model

This commit is contained in:
mwiegand 2026-05-13 14:24:47 +02:00
parent f3f0a8927a
commit 0a7f48f174
No known key found for this signature in database
2 changed files with 33 additions and 0 deletions

View file

@ -0,0 +1,30 @@
"""add hostname column to servers
Revision ID: 0011_server_hostname
Revises: 0010_server_live_state
Create Date: 2026-05-13
"""
from __future__ import annotations
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
revision: str = "0011_server_hostname"
down_revision: Union[str, Sequence[str], None] = "0010_server_live_state"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
with op.batch_alter_table("servers") as batch_op:
batch_op.add_column(
sa.Column("hostname", sa.String(length=128), nullable=False, server_default="")
)
def downgrade() -> None:
with op.batch_alter_table("servers") as batch_op:
batch_op.drop_column("hostname")

View file

@ -146,6 +146,9 @@ class Server(Base):
rcon_password: Mapped[str] = mapped_column(
String(64), nullable=False, default="", server_default=""
)
hostname: Mapped[str] = mapped_column(
String(128), nullable=False, default="", server_default=""
)
created_at: Mapped[datetime] = mapped_column(DateTime, default=now_utc, nullable=False)
updated_at: Mapped[datetime] = mapped_column(DateTime, default=now_utc, nullable=False)