Skip to content

Commit

Permalink
Merge pull request #313 from GispoCoding/add_field_kaavatunnus
Browse files Browse the repository at this point in the history
Add kaavatunnus field for visualization
  • Loading branch information
msorvoja committed Aug 7, 2024
2 parents 35e9747 + 3eb3ceb commit a4d4ed8
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions database/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class PlanObjectBase(PlanBase):
height_range: Mapped[numeric_range]
height_unit: Mapped[str] = mapped_column(nullable=True)
ordering: Mapped[Optional[int]] = mapped_column(index=True)
plan_identifier: Mapped[Optional[str]] # Kaavatunnus
type_of_underground_id: Mapped[uuid.UUID] = mapped_column(
ForeignKey("codes.type_of_underground.id", name="type_of_underground_id_fkey"),
index=True,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"""add_kaavatunnus_for_plan_objects
Revision ID: 983a19a2ea1e
Revises: feb5395835bb
Create Date: 2024-08-07 15:13:34.255811
"""
from typing import Sequence, Union

import geoalchemy2
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "983a19a2ea1e"
down_revision: Union[str, None] = "feb5395835bb"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"land_use_area",
sa.Column("plan_identifier", sa.String(), nullable=True),
schema="hame",
)
op.add_column(
"land_use_point",
sa.Column("plan_identifier", sa.String(), nullable=True),
schema="hame",
)
op.add_column(
"line",
sa.Column("plan_identifier", sa.String(), nullable=True),
schema="hame",
)
op.add_column(
"other_area",
sa.Column("plan_identifier", sa.String(), nullable=True),
schema="hame",
)
op.add_column(
"other_point",
sa.Column("plan_identifier", sa.String(), nullable=True),
schema="hame",
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("other_point", "plan_identifier", schema="hame")
op.drop_column("other_area", "plan_identifier", schema="hame")
op.drop_column("line", "plan_identifier", schema="hame")
op.drop_column("land_use_point", "plan_identifier", schema="hame")
op.drop_column("land_use_area", "plan_identifier", schema="hame")
# ### end Alembic commands ###

0 comments on commit a4d4ed8

Please sign in to comment.