feat(l4d2-web): add hostname column to Server model
This commit is contained in:
parent
f3f0a8927a
commit
0a7f48f174
2 changed files with 33 additions and 0 deletions
30
l4d2web/alembic/versions/0011_server_hostname.py
Normal file
30
l4d2web/alembic/versions/0011_server_hostname.py
Normal 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")
|
||||||
|
|
@ -146,6 +146,9 @@ class Server(Base):
|
||||||
rcon_password: Mapped[str] = mapped_column(
|
rcon_password: Mapped[str] = mapped_column(
|
||||||
String(64), nullable=False, default="", server_default=""
|
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)
|
created_at: Mapped[datetime] = mapped_column(DateTime, default=now_utc, nullable=False)
|
||||||
updated_at: Mapped[datetime] = mapped_column(DateTime, default=now_utc, nullable=False)
|
updated_at: Mapped[datetime] = mapped_column(DateTime, default=now_utc, nullable=False)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue