From bd321989abf384bd363bcb83b6484d30ecb63153 Mon Sep 17 00:00:00 2001 From: Atalya Alon Date: Wed, 4 Sep 2024 23:20:41 +0300 Subject: [PATCH 1/2] add house number in models, db_views, alembic --- .../versions/mn9px8cacn24_add_house_number.py | 31 +++++++++++++++++++ anyway/db_views.py | 1 + anyway/models.py | 2 ++ 3 files changed, 34 insertions(+) create mode 100644 alembic/versions/mn9px8cacn24_add_house_number.py diff --git a/alembic/versions/mn9px8cacn24_add_house_number.py b/alembic/versions/mn9px8cacn24_add_house_number.py new file mode 100644 index 00000000..33631f31 --- /dev/null +++ b/alembic/versions/mn9px8cacn24_add_house_number.py @@ -0,0 +1,31 @@ +"""add house number + +Revision ID: mn9px8cacn24 +Revises: 53d0b00fb750 +Create Date: 2024-06-16 15:05:30.522542 + +""" + +# revision identifiers, used by Alembic. +revision = 'mn9px8cacn24' +down_revision = '53d0b00fb750' +branch_labels = None +depends_on = None + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('involved_markers_hebrew', sa.Column('house_number', sa.Integer(), nullable=True)) + op.add_column('vehicles_markers_hebrew', sa.Column('house_number', sa.Integer(), nullable=True)) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('vehicles_markers_hebrew', 'house_number') + op.drop_column('involved_markers_hebrew', 'house_number') + # ### end Alembic commands ### \ No newline at end of file diff --git a/anyway/db_views.py b/anyway/db_views.py index 6f7ff621..cce69bb4 100644 --- a/anyway/db_views.py +++ b/anyway/db_views.py @@ -837,6 +837,7 @@ def create_vehicles_markers_hebrew_view(self): AccidentMarkerView.street1_hebrew, AccidentMarkerView.street2, AccidentMarkerView.street2_hebrew, + AccidentMarkerView.house_number, AccidentMarkerView.non_urban_intersection, AccidentMarkerView.non_urban_intersection_hebrew, AccidentMarkerView.non_urban_intersection_by_junction_number, diff --git a/anyway/models.py b/anyway/models.py index 80f248b9..d28182b0 100755 --- a/anyway/models.py +++ b/anyway/models.py @@ -2532,6 +2532,7 @@ class InvolvedMarkerView(Base): street1_hebrew = Column(Text(), index=True) street2 = Column(Integer()) street2_hebrew = Column(Text(), index=True) + house_number = Column(Integer()) non_urban_intersection = Column(Integer()) non_urban_intersection_hebrew = Column(Text()) non_urban_intersection_by_junction_number = Column(Text()) @@ -2729,6 +2730,7 @@ class VehicleMarkerView(Base): street1_hebrew = Column(Text(), index=True) street2 = Column(Integer()) street2_hebrew = Column(Text(), index=True) + house_number = Column(Integer()) non_urban_intersection = Column(Integer()) non_urban_intersection_hebrew = Column(Text()) non_urban_intersection_by_junction_number = Column(Text()) From 0279e5ba80b4de178a8be983c1be98e7184a81ae Mon Sep 17 00:00:00 2001 From: Atalya Alon <20992625+atalyaalon@users.noreply.github.com> Date: Wed, 4 Sep 2024 23:22:21 +0300 Subject: [PATCH 2/2] Update revision --- alembic/versions/mn9px8cacn24_add_house_number.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alembic/versions/mn9px8cacn24_add_house_number.py b/alembic/versions/mn9px8cacn24_add_house_number.py index 33631f31..7e09db3c 100644 --- a/alembic/versions/mn9px8cacn24_add_house_number.py +++ b/alembic/versions/mn9px8cacn24_add_house_number.py @@ -1,14 +1,14 @@ """add house number Revision ID: mn9px8cacn24 -Revises: 53d0b00fb750 +Revises: 97740b33407d Create Date: 2024-06-16 15:05:30.522542 """ # revision identifiers, used by Alembic. revision = 'mn9px8cacn24' -down_revision = '53d0b00fb750' +down_revision = '97740b33407d' branch_labels = None depends_on = None @@ -28,4 +28,4 @@ def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('vehicles_markers_hebrew', 'house_number') op.drop_column('involved_markers_hebrew', 'house_number') - # ### end Alembic commands ### \ No newline at end of file + # ### end Alembic commands ###