Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
6b9dff2
adding table models for new cbs fields
tkalir Feb 2, 2026
2d25d22
adding alembic migration for new dictionary tables
tkalir Feb 2, 2026
05a55ca
adding intersection columns
tkalir Feb 10, 2026
f511ead
adding junction and junction_arm tables
tkalir Feb 10, 2026
35ad180
adding alembic migration for junction and junction_arm
tkalir Feb 10, 2026
feafff1
adding new cbs static junction files
tkalir Feb 10, 2026
83210b1
adding junction parser
tkalir Feb 11, 2026
cce3cce
Merge pull request #2904 from tkalir/new-cbs-format-reading-junction-…
tkalir Feb 11, 2026
4df1280
removing old junction columns
tkalir Feb 11, 2026
437336f
Merge branch 'new-cbs-format' of https://github.com/data-for-change/a…
tkalir Feb 12, 2026
3c723b8
Merge pull request #2905 from tkalir/new-cbs-format-removing-old-junc…
tkalir Feb 12, 2026
fc03964
removing usage of unit field
tkalir Feb 12, 2026
d802726
removing police unit columns
tkalir Feb 12, 2026
5022ea9
Merge pull request #2906 from tkalir/new-cbs-format-remove-unit-field
tkalir Feb 12, 2026
b5007ce
removing road shape usage and columns
tkalir Feb 12, 2026
a3d8d25
adding migration to remove road_shape
tkalir Feb 12, 2026
c7d227f
Merge pull request #2907 from tkalir/new-cbs-format-removing-road-shape
tkalir Feb 12, 2026
2c3bd84
removing road shape usage and columns
tkalir Feb 12, 2026
c44aa7c
adding migration to remove road sign columns
tkalir Feb 12, 2026
dbf696d
Merge pull request #2908 from tkalir/new-cbs-format-removing-road-sign
tkalir Feb 12, 2026
030086c
removing vehicle status column usage
tkalir Feb 12, 2026
1ac46ba
adding migration file for removing vehicle status columns
tkalir Feb 12, 2026
b15643e
adding cross columns to involved
tkalir Feb 12, 2026
3b9a635
moving cross columns from markers to involved
tkalir Feb 12, 2026
d238293
adding migration for removing cross columns
tkalir Feb 12, 2026
21cf76a
Merge pull request #2909 from tkalir/new-cbs-column-moving-cross-colu…
tkalir Feb 12, 2026
5577a5b
adding new columns to markers tables
tkalir Feb 13, 2026
049847e
Merge pull request #2911 from tkalir/new-cbs-format-adding-accident-c…
tkalir Feb 13, 2026
d74687a
adding new vehicle types
tkalir Feb 17, 2026
41f27c5
Merge pull request #2912 from tkalir/new-cbs-format-add-new-vehicel-t…
tkalir Feb 17, 2026
006000d
adjust parser for new format
tkalir Feb 18, 2026
b9318ea
extracting cbs dictionary handling
tkalir Feb 19, 2026
0f3928e
Merge pull request #2913 from tkalir/new-cbs-format-adjust-parser
tkalir Feb 19, 2026
9e86940
Merge pull request #2914 from data-for-change/dev
tkalir Feb 19, 2026
5a1b205
Update deploy conditions for new-cbs-format branch
tkalir Feb 19, 2026
b2c0897
trigger ci
tkalir Feb 19, 2026
2d37fd9
trigger deploy via push to new-cbs-format
tkalir Feb 19, 2026
b5c8576
trigger ci
tkalir Feb 21, 2026
85153be
Merge branch 'new-cbs-format' of https://github.com/data-for-change/a…
tkalir Feb 21, 2026
dc7b226
trigger deployment
tkalir Feb 22, 2026
c3b816c
fix deployment workflow for new-cbs-format
tkalir Feb 22, 2026
3193e8a
trigger deployment
tkalir Feb 22, 2026
67ca13b
fix streets dict read
tkalir Feb 22, 2026
1d8ee20
fix streets dict read
tkalir Feb 22, 2026
bbd0d2d
fix streets dict read
tkalir Feb 22, 2026
3a9189e
changing safety_data_accident vehicles to bigint
tkalir Feb 24, 2026
8e64163
fixing support for new vehicle values
tkalir Feb 24, 2026
bba9e6b
updated injured_type list in involved_query
tkalir Feb 25, 2026
084fe19
Merge pull request #2915 from tkalir/new-cbs-format-fix-involved-quer…
tkalir Feb 25, 2026
ee2ac8a
Fix bitwise shift operation for vehicle type
tkalir Mar 4, 2026
eae61e2
Add street1 and street2 to involved query result.
ziv17 Apr 10, 2026
7d34970
Merge pull request #2916 from ziv17/new-cbs-format
ziv17 Apr 10, 2026
e9f669a
adding electric motorcycle to vehicle types
tkalir Apr 14, 2026
b72b699
allowing missing year\provider code on cbs data update
tkalir Apr 14, 2026
bced9f7
Merge pull request #2918 from tkalir/new-cbs-format-allow-missing-files
tkalir Apr 14, 2026
a431c0e
Add support for safety-data.dfc2.anyway.co.il
ziv17 May 11, 2026
289efcd
Handle error in getting osm data while loading CBS cities data
ziv17 May 12, 2026
c35b834
Merge pull request #2922 from ziv17/new-cbs-format
ziv17 May 12, 2026
5921b08
refactor cbs executor main
tkalir May 14, 2026
0f5f407
Merge pull request #2923 from tkalir/new-cbs-format-refactor-cbs-exec…
tkalir May 17, 2026
d237d5f
fixing column name lookup for accident type
tkalir May 17, 2026
0fbfd0b
Merge pull request #2924 from tkalir/new-cbs-format-fix-email-import
tkalir May 17, 2026
7b35ed9
fix new_file_type in field_names.py
tkalir May 18, 2026
e7cde03
Merge branch 'data-for-change:new-cbs-format' into new-cbs-format
tkalir May 18, 2026
1e9f88a
fixing get_file_type_and_year
tkalir May 18, 2026
2b579a9
Merge pull request #2925 from tkalir/new-cbs-format-fix-email-import-2
tkalir May 18, 2026
4153cf7
Fix casing of new_accident_year variable
tkalir May 25, 2026
2d2200e
added logging file name when exception occurs parsing file in executo…
tkalir Jun 21, 2026
a31c2c0
supporting cbs rehev or rechev file names
tkalir Jun 21, 2026
71ce0bb
adding support for either csv or xslx files in cbs parser
tkalir Jun 21, 2026
8a64d73
Merge pull request #2928 from tkalir/new-cbs-format-fix-email-import-2
tkalir Jun 21, 2026
226c9ab
Update session and remember cookie names
tkalir Jun 23, 2026
c7a0d5e
Enhance logging in OAuth authorization and user check
tkalir Jun 23, 2026
f4c6814
Integrate logging into user_system
tkalir Jun 23, 2026
f533b63
Replace logger with direct logging calls
tkalir Jun 23, 2026
88c7b51
using logging.info level in user_system/api
tkalir Jun 23, 2026
2132b8b
Treat already logged in in oauth_authorize as success
tkalir Jun 24, 2026
779f45b
adding safety_data_admin page
tkalir Jun 24, 2026
d3dc45d
Merge branch 'new-cbs-format' of https://github.com/data-for-change/a…
tkalir Jun 24, 2026
3f83712
Revert "adding safety_data_admin page"
tkalir Jun 24, 2026
898a3d4
Temporarily allow GET and POST on safety data involved endpoints.
tkalir Jul 2, 2026
33d5f2f
Add geom column and spatial index to SDAccident.
tkalir Jul 2, 2026
41a7edb
added geo filter to sd endpoints
tkalir Jul 2, 2026
a75cacf
Merge pull request #2930 from tkalir/2929-add-polygon-filter-to-safet…
tkalir Jul 3, 2026
da76f28
Require grant for polygon filtering
tkalir Jul 7, 2026
a0731db
Change SD geo filter's structure
tkalir Jul 7, 2026
2ecae07
Implement user grant validation for safety data filters
tkalir Jul 8, 2026
08d43f5
Merge pull request #2932 from tkalir/2929-add-polygon-filter-to-safet…
tkalir Jul 8, 2026
4bf2c06
Fix POLYGON_FILTERING_GRANT variable naming
tkalir Jul 11, 2026
d5eaad9
temporarily disable permission check for polygon filtering
tkalir Jul 15, 2026
1985bd2
Add set_user_grants endpoint for admin page
tkalir Jul 24, 2026
61792f5
Add get user by email endpoint
tkalir Jul 24, 2026
38a939e
Merge pull request #2933 from tkalir/add-set-grants-endpoint
tkalir Jul 24, 2026
6828846
Add List type import to api.py
tkalir Jul 24, 2026
9cdf29f
Update return type of _get_grants_list function
tkalir Jul 24, 2026
4d3d52b
restore grant checking for polygon filtering
tkalir Jul 24, 2026
03470a4
Extract bounding box query from models.py
tkalir Jul 24, 2026
66db565
Merge pull request #2936 from tkalir/extract-bounding-box-query
tkalir Jul 24, 2026
9ceb240
add empty_result in bounding box query
tkalir Jul 24, 2026
b7222f4
refactor marker_bounding_box_query
tkalir Jul 24, 2026
f5a06e4
Merge pull request #2937 from tkalir/refacotr-bounding-box-query
tkalir Jul 24, 2026
fd9051d
move accident type to jinga
tkalir Jul 25, 2026
b149960
update map filters for current CBS codes
tkalir Jul 25, 2026
b06d8d2
Merge pull request #2938 from tkalir/refacotr-bounding-box-query
tkalir Jul 25, 2026
2458fac
validate required CBS files before import
tkalir Jul 25, 2026
f63acd6
add table-creation duration logs
tkalir Jul 25, 2026
8a3ac6b
Add debug lines to cbs executor
tkalir Jul 25, 2026
d990ffd
Merge pull request #2939 from tkalir/refacotr-bounding-box-query
tkalir Jul 25, 2026
fb4780f
fix road segment calculation according to current cbs format
tkalir Jul 31, 2026
62a7faf
Merge pull request #2940 from tkalir/new-cbs-format-fix-road-segments
tkalir Jul 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"""removing cross columns from markers

Revision ID: 205025444ebe
Revises: 237ab8f171d0
Create Date: 2026-02-12 21:29:57.945021
"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "205025444ebe"
down_revision = "237ab8f171d0"
branch_labels = None
depends_on = None


def upgrade():
# markers
op.drop_column("markers", "cross_location")
op.drop_column("markers", "cross_direction")
op.drop_column("markers", "didnt_cross")
op.drop_column("markers", "cross_mode")

# markers_hebrew
op.drop_column("markers_hebrew", "cross_location")
op.drop_column("markers_hebrew", "cross_direction")
op.drop_column("markers_hebrew", "didnt_cross")
op.drop_column("markers_hebrew", "cross_mode")

op.drop_column("markers_hebrew", "cross_location_hebrew")
op.drop_column("markers_hebrew", "cross_direction_hebrew")
op.drop_column("markers_hebrew", "didnt_cross_hebrew")
op.drop_column("markers_hebrew", "cross_mode_hebrew")

# vehicles_markers_hebrew
op.drop_column("vehicles_markers_hebrew", "cross_location")
op.drop_column("vehicles_markers_hebrew", "cross_direction")
op.drop_column("vehicles_markers_hebrew", "didnt_cross")
op.drop_column("vehicles_markers_hebrew", "cross_mode")

op.drop_column("vehicles_markers_hebrew", "cross_location_hebrew")
op.drop_column("vehicles_markers_hebrew", "cross_direction_hebrew")
op.drop_column("vehicles_markers_hebrew", "didnt_cross_hebrew")
op.drop_column("vehicles_markers_hebrew", "cross_mode_hebrew")


def downgrade():
# markers
op.add_column("markers", sa.Column("cross_location", sa.Integer(), nullable=True))
op.add_column("markers", sa.Column("cross_direction", sa.Integer(), nullable=True))
op.add_column("markers", sa.Column("didnt_cross", sa.Integer(), nullable=True))
op.add_column("markers", sa.Column("cross_mode", sa.Integer(), nullable=True))

# markers_hebrew
op.add_column("markers_hebrew", sa.Column("cross_location", sa.Integer(), nullable=True))
op.add_column("markers_hebrew", sa.Column("cross_direction", sa.Integer(), nullable=True))
op.add_column("markers_hebrew", sa.Column("didnt_cross", sa.Integer(), nullable=True))
op.add_column("markers_hebrew", sa.Column("cross_mode", sa.Integer(), nullable=True))

op.add_column("markers_hebrew", sa.Column("cross_location_hebrew", sa.Text(), nullable=True))
op.add_column("markers_hebrew", sa.Column("cross_direction_hebrew", sa.Text(), nullable=True))
op.add_column("markers_hebrew", sa.Column("didnt_cross_hebrew", sa.Text(), nullable=True))
op.add_column("markers_hebrew", sa.Column("cross_mode_hebrew", sa.Text(), nullable=True))

# vehicles_markers_hebrew
op.add_column("vehicles_markers_hebrew", sa.Column("cross_location", sa.Integer(), nullable=True))
op.add_column("vehicles_markers_hebrew", sa.Column("cross_direction", sa.Integer(), nullable=True))
op.add_column("vehicles_markers_hebrew", sa.Column("didnt_cross", sa.Integer(), nullable=True))
op.add_column("vehicles_markers_hebrew", sa.Column("cross_mode", sa.Integer(), nullable=True))

op.add_column("vehicles_markers_hebrew", sa.Column("cross_location_hebrew", sa.Text(), nullable=True))
op.add_column("vehicles_markers_hebrew", sa.Column("cross_direction_hebrew", sa.Text(), nullable=True))
op.add_column("vehicles_markers_hebrew", sa.Column("didnt_cross_hebrew", sa.Text(), nullable=True))
op.add_column("vehicles_markers_hebrew", sa.Column("cross_mode_hebrew", sa.Text(), nullable=True))
54 changes: 54 additions & 0 deletions alembic/versions/237ab8f171d0_adding_cross_columns_to_involved.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""adding cross columns to involved

Revision ID: 237ab8f171d0
Revises: ef951922e4ef
Create Date: 2026-02-12 20:56:58.410115
"""

from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = "237ab8f171d0"
down_revision = "ef951922e4ef"
branch_labels = None
depends_on = None


def upgrade():
# involved (raw)
op.add_column("involved", sa.Column("cross_direction", sa.Integer(), nullable=True))
op.add_column("involved", sa.Column("cross_location", sa.Integer(), nullable=True))
op.add_column("involved", sa.Column("cross_mode", sa.Integer(), nullable=True))
op.add_column("involved", sa.Column("didnt_cross", sa.Integer(), nullable=True))

# involved_hebrew (decorated)
op.add_column("involved_hebrew", sa.Column("cross_direction", sa.Integer(), nullable=True))
op.add_column("involved_hebrew", sa.Column("cross_direction_hebrew", sa.Text(), nullable=True))

op.add_column("involved_hebrew", sa.Column("cross_location", sa.Integer(), nullable=True))
op.add_column("involved_hebrew", sa.Column("cross_location_hebrew", sa.Text(), nullable=True))

op.add_column("involved_hebrew", sa.Column("cross_mode", sa.Integer(), nullable=True))
op.add_column("involved_hebrew", sa.Column("cross_mode_hebrew", sa.Text(), nullable=True))

op.add_column("involved_hebrew", sa.Column("didnt_cross", sa.Integer(), nullable=True))
op.add_column("involved_hebrew", sa.Column("didnt_cross_hebrew", sa.Text(), nullable=True))


def downgrade():
# involved_hebrew
op.drop_column("involved_hebrew", "didnt_cross_hebrew")
op.drop_column("involved_hebrew", "didnt_cross")
op.drop_column("involved_hebrew", "cross_mode_hebrew")
op.drop_column("involved_hebrew", "cross_mode")
op.drop_column("involved_hebrew", "cross_location_hebrew")
op.drop_column("involved_hebrew", "cross_location")
op.drop_column("involved_hebrew", "cross_direction_hebrew")
op.drop_column("involved_hebrew", "cross_direction")

# involved
op.drop_column("involved", "didnt_cross")
op.drop_column("involved", "cross_mode")
op.drop_column("involved", "cross_location")
op.drop_column("involved", "cross_direction")
96 changes: 96 additions & 0 deletions alembic/versions/333a785776cd_add_new_dictionary_tables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
"""Add new dictionary tables

Revision ID: 333a785776cd
Revises: b7c8d9e0f1a2
Create Date: 2026-02-02 17:47:20.438985

"""

# revision identifiers, used by Alembic.
revision = '333a785776cd'
down_revision = 'b7c8d9e0f1a2'
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.create_table('entrance_exit',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('year', sa.Integer(), nullable=False),
sa.Column('provider_code', sa.Integer(), nullable=False),
sa.Column('entrance_exit_hebrew', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id', 'year', 'provider_code')
)
op.create_index(op.f('ix_entrance_exit_id'), 'entrance_exit', ['id'], unique=False)
op.create_index(op.f('ix_entrance_exit_provider_code'), 'entrance_exit', ['provider_code'], unique=False)
op.create_index(op.f('ix_entrance_exit_year'), 'entrance_exit', ['year'], unique=False)
op.create_table('infrastructure_type',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('year', sa.Integer(), nullable=False),
sa.Column('provider_code', sa.Integer(), nullable=False),
sa.Column('infrastructure_type_hebrew', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id', 'year', 'provider_code')
)
op.create_index(op.f('ix_infrastructure_type_id'), 'infrastructure_type', ['id'], unique=False)
op.create_index(op.f('ix_infrastructure_type_provider_code'), 'infrastructure_type', ['provider_code'], unique=False)
op.create_index(op.f('ix_infrastructure_type_year'), 'infrastructure_type', ['year'], unique=False)
op.create_table('road_alignment',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('year', sa.Integer(), nullable=False),
sa.Column('provider_code', sa.Integer(), nullable=False),
sa.Column('road_alignment_hebrew', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id', 'year', 'provider_code')
)
op.create_index(op.f('ix_road_alignment_id'), 'road_alignment', ['id'], unique=False)
op.create_index(op.f('ix_road_alignment_provider_code'), 'road_alignment', ['provider_code'], unique=False)
op.create_index(op.f('ix_road_alignment_year'), 'road_alignment', ['year'], unique=False)
op.create_table('road_geometry',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('year', sa.Integer(), nullable=False),
sa.Column('provider_code', sa.Integer(), nullable=False),
sa.Column('road_geometry_hebrew', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id', 'year', 'provider_code')
)
op.create_index(op.f('ix_road_geometry_id'), 'road_geometry', ['id'], unique=False)
op.create_index(op.f('ix_road_geometry_provider_code'), 'road_geometry', ['provider_code'], unique=False)
op.create_index(op.f('ix_road_geometry_year'), 'road_geometry', ['year'], unique=False)
op.create_table('vehicle_purpose',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('year', sa.Integer(), nullable=False),
sa.Column('provider_code', sa.Integer(), nullable=False),
sa.Column('vehicle_purpose_hebrew', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id', 'year', 'provider_code')
)
op.create_index(op.f('ix_vehicle_purpose_id'), 'vehicle_purpose', ['id'], unique=False)
op.create_index(op.f('ix_vehicle_purpose_provider_code'), 'vehicle_purpose', ['provider_code'], unique=False)
op.create_index(op.f('ix_vehicle_purpose_year'), 'vehicle_purpose', ['year'], unique=False)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_vehicle_purpose_year'), table_name='vehicle_purpose')
op.drop_index(op.f('ix_vehicle_purpose_provider_code'), table_name='vehicle_purpose')
op.drop_index(op.f('ix_vehicle_purpose_id'), table_name='vehicle_purpose')
op.drop_table('vehicle_purpose')
op.drop_index(op.f('ix_road_geometry_year'), table_name='road_geometry')
op.drop_index(op.f('ix_road_geometry_provider_code'), table_name='road_geometry')
op.drop_index(op.f('ix_road_geometry_id'), table_name='road_geometry')
op.drop_table('road_geometry')
op.drop_index(op.f('ix_road_alignment_year'), table_name='road_alignment')
op.drop_index(op.f('ix_road_alignment_provider_code'), table_name='road_alignment')
op.drop_index(op.f('ix_road_alignment_id'), table_name='road_alignment')
op.drop_table('road_alignment')
op.drop_index(op.f('ix_infrastructure_type_year'), table_name='infrastructure_type')
op.drop_index(op.f('ix_infrastructure_type_provider_code'), table_name='infrastructure_type')
op.drop_index(op.f('ix_infrastructure_type_id'), table_name='infrastructure_type')
op.drop_table('infrastructure_type')
op.drop_index(op.f('ix_entrance_exit_year'), table_name='entrance_exit')
op.drop_index(op.f('ix_entrance_exit_provider_code'), table_name='entrance_exit')
op.drop_index(op.f('ix_entrance_exit_id'), table_name='entrance_exit')
op.drop_table('entrance_exit')
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""adding junction and junction_arm tables

Revision ID: 39966aa5db4d
Revises: c5d5e94fb059
Create Date: 2026-02-10 16:45:35.963690

"""

# revision identifiers, used by Alembic.
revision = '39966aa5db4d'
down_revision = 'c5d5e94fb059'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
op.create_table(
'junction',
sa.Column('junction', sa.Integer(), nullable=False),
sa.Column('junction_hebrew', sa.String(length=100), nullable=True),
sa.Column('x', sa.Float(), nullable=True),
sa.Column('y', sa.Float(), nullable=True),
sa.PrimaryKeyConstraint('junction'),
)
op.create_table(
'junction_arm',
sa.Column('arm_symbol', sa.Integer(), nullable=False),
sa.Column('junction_symbol', sa.Integer(), nullable=True),
sa.Column('is_suburban', sa.Boolean(), nullable=True),
sa.Column('road_symbol', sa.Integer(), nullable=True),
sa.Column('km', sa.Float(), nullable=True),
sa.Column('yishuv_symbol', sa.Integer(), nullable=True),
sa.Column('street_symbol', sa.Integer(), nullable=True),
sa.Column('arm_name', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('arm_symbol'),
)
op.create_index(op.f('ix_junction_arm_arm_symbol'), 'junction_arm', ['arm_symbol'], unique=False)


def downgrade():
op.drop_index(op.f('ix_junction_arm_arm_symbol'), table_name='junction_arm')
op.drop_table('junction_arm')
op.drop_table('junction')
# ### end Alembic commands ###
84 changes: 84 additions & 0 deletions alembic/versions/42609a9cb467_removing_road_shape_columns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
"""removing road shape columns

Revision ID: 42609a9cb467
Revises: b460c29c20b7
Create Date: 2026-02-12 15:09:04.110756
"""

from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = "42609a9cb467"
down_revision = "b460c29c20b7"
branch_labels = None
depends_on = None


def upgrade():
# drop road_shape columns from tables/views
op.drop_column("injured_around_school_all_data", "markers_road_shape")

op.drop_column("involved_markers_hebrew", "road_shape")
op.drop_column("involved_markers_hebrew", "road_shape_hebrew")

op.drop_column("markers", "road_shape")

op.drop_column("markers_hebrew", "road_shape")
op.drop_column("markers_hebrew", "road_shape_hebrew")

op.drop_column("vehicles_markers_hebrew", "road_shape")
op.drop_column("vehicles_markers_hebrew", "road_shape_hebrew")

# drop the dimension table itself (only if it was removed from models)
op.drop_table("road_shape")


def downgrade():
# recreate road_shape table (as it was in the autogen)
op.create_table(
"road_shape",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("year", sa.Integer(), nullable=False),
sa.Column("provider_code", sa.Integer(), nullable=False),
sa.Column("road_shape_hebrew", sa.Text(), nullable=True),
sa.PrimaryKeyConstraint("id", "year", "provider_code", name="road_shape_pkey"),
)

# add columns back
op.add_column(
"vehicles_markers_hebrew",
sa.Column("road_shape_hebrew", sa.Text(), nullable=True),
)
op.add_column(
"vehicles_markers_hebrew",
sa.Column("road_shape", sa.Integer(), nullable=True),
)

op.add_column(
"markers_hebrew",
sa.Column("road_shape_hebrew", sa.Text(), nullable=True),
)
op.add_column(
"markers_hebrew",
sa.Column("road_shape", sa.Integer(), nullable=True),
)

op.add_column(
"markers",
sa.Column("road_shape", sa.Integer(), nullable=True),
)

op.add_column(
"involved_markers_hebrew",
sa.Column("road_shape_hebrew", sa.Text(), nullable=True),
)
op.add_column(
"involved_markers_hebrew",
sa.Column("road_shape", sa.Integer(), nullable=True),
)

op.add_column(
"injured_around_school_all_data",
sa.Column("markers_road_shape", sa.Float(), nullable=True),
)
Loading
Loading