Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
backend: add route description field
Browse files Browse the repository at this point in the history
  • Loading branch information
OxygenCobalt committed Mar 24, 2024
1 parent e6065d8 commit 317983c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
29 changes: 29 additions & 0 deletions backend/alembic/versions/4183de971218_add_route_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""add route description
Revision ID: 4183de971218
Revises: 8166e12f260c
Create Date: 2024-03-24 12:31:02.141874
"""

from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "4183de971218"
down_revision: Union[str, None] = "8166e12f260c"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.add_column(
"routes",
sa.Column("description", sa.String(255), nullable=False, server_default=""),
)


def downgrade() -> None:
op.drop_column("routes", "description")
5 changes: 5 additions & 0 deletions backend/src/model/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class Route(Base):
String(7),
nullable=True,
)
description: Mapped[str] = mapped_column(
String(255),
nullable=False,
server_default="",
)

waypoints = relationship("Waypoint", backref="route", cascade="all, delete-orphan")

Expand Down

0 comments on commit 317983c

Please sign in to comment.