Skip to content

Commit

Permalink
Merge pull request #2692 from ziv17/2691-add-indexes
Browse files Browse the repository at this point in the history
Add indexes to numeric street location fields and remove from street string location fields.
  • Loading branch information
atalyaalon authored Sep 2, 2024
2 parents 4a1bc56 + 32263e5 commit b55f948
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions alembic/versions/97740b33407d_add_numeric_indexes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""add numeric indexes
Revision ID: 97740b33407d
Revises: 53d0b00fb750
Create Date: 2024-08-24 11:19:33.674396
"""

# revision identifiers, used by Alembic.
revision = '97740b33407d'
down_revision = '53d0b00fb750'
branch_labels = None
depends_on = None

from alembic import op
# import sqlalchemy as sa


# pylint: disable=E1101
def upgrade():
for table in ['markers', 'markers_hebrew']:
for field in ['yishuv_symbol', 'street1', 'street2']:
op.create_index(f'ix_{table}_{field}', table, [field], unique=False)
for table in ['markers_hebrew']:
for field in ['yishuv_name', 'street1_hebrew', 'street2_hebrew']:
op.drop_index(f'ix_{table}_{field}', table_name=table)


# pylint: disable=E1101
def downgrade():
for table in ['markers', 'markers_hebrew']:
for field in ['yishuv_symbol', 'street1', 'street2']:
op.drop_index(f'ix_{table}_{field}', table_name=table)
for table in ['markers_hebrew']:
for field in ['yishuv_name', 'street1_hebrew', 'street2_hebrew']:
op.create_index(f'ix_{table}_{field}', table, [field], unique=False)

0 comments on commit b55f948

Please sign in to comment.