From 957558158a51e9d05871c7230d489e95245ca8be Mon Sep 17 00:00:00 2001 From: Atalya Alon Date: Sun, 16 Jun 2024 17:08:36 +0300 Subject: [PATCH] add urban-intersection to views --- ...53d0b00fb750_add_non_urban_intersection.py | 30 +++++++++++++++++++ anyway/db_views.py | 2 ++ anyway/models.py | 2 ++ 3 files changed, 34 insertions(+) create mode 100644 alembic/versions/53d0b00fb750_add_non_urban_intersection.py diff --git a/alembic/versions/53d0b00fb750_add_non_urban_intersection.py b/alembic/versions/53d0b00fb750_add_non_urban_intersection.py new file mode 100644 index 000000000..491c7db0e --- /dev/null +++ b/alembic/versions/53d0b00fb750_add_non_urban_intersection.py @@ -0,0 +1,30 @@ +"""add non_urban_intersection + +Revision ID: 53d0b00fb750 +Revises: 11ddb0cff075 +Create Date: 2024-06-16 15:05:30.522542 + +""" + +# revision identifiers, used by Alembic. +revision = '53d0b00fb750' +down_revision = '11ddb0cff075' +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('urban_intersection', sa.Integer(), nullable=True)) + op.add_column('vehicles_markers_hebrew', sa.Column('urban_intersection', sa.Integer(), nullable=True)) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('vehicles_markers_hebrew', 'urban_intersection') + op.drop_column('involved_markers_hebrew', 'urban_intersection') + # ### end Alembic commands ### diff --git a/anyway/db_views.py b/anyway/db_views.py index 112226d16..8231ba78d 100644 --- a/anyway/db_views.py +++ b/anyway/db_views.py @@ -641,6 +641,7 @@ def create_involved_hebrew_markers_hebrew_view(self): AccidentMarkerView.non_urban_intersection, AccidentMarkerView.non_urban_intersection_hebrew, AccidentMarkerView.non_urban_intersection_by_junction_number, + AccidentMarkerView.urban_intersection, AccidentMarkerView.accident_day, AccidentMarkerView.accident_hour_raw, AccidentMarkerView.accident_hour_raw_hebrew, @@ -838,6 +839,7 @@ def create_vehicles_markers_hebrew_view(self): AccidentMarkerView.non_urban_intersection, AccidentMarkerView.non_urban_intersection_hebrew, AccidentMarkerView.non_urban_intersection_by_junction_number, + AccidentMarkerView.urban_intersection, AccidentMarkerView.accident_day, AccidentMarkerView.accident_hour_raw, AccidentMarkerView.accident_hour_raw_hebrew, diff --git a/anyway/models.py b/anyway/models.py index 229733468..6ac1a9c19 100755 --- a/anyway/models.py +++ b/anyway/models.py @@ -2505,6 +2505,7 @@ class InvolvedMarkerView(Base): non_urban_intersection = Column(Integer()) non_urban_intersection_hebrew = Column(Text()) non_urban_intersection_by_junction_number = Column(Text()) + urban_intersection = Column(Integer()) accident_day = Column(Integer()) accident_hour_raw = Column(Integer()) accident_hour_raw_hebrew = Column(Text()) @@ -2701,6 +2702,7 @@ class VehicleMarkerView(Base): non_urban_intersection = Column(Integer()) non_urban_intersection_hebrew = Column(Text()) non_urban_intersection_by_junction_number = Column(Text()) + urban_intersection = Column(Integer()) accident_month = Column(Integer()) accident_day = Column(Integer()) accident_hour_raw = Column(Integer())