forked from bcgov/STRR
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request bcgov#62 from turb0c0w/tyler/registrations_search
Tyler/registrations search
- Loading branch information
Showing
11 changed files
with
271 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"""Add search and sort indices | ||
Revision ID: 2b707ec995f7 | ||
Revises: 269514c7d861 | ||
Create Date: 2024-07-19 11:03:26.021314 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '2b707ec995f7' | ||
down_revision = '269514c7d861' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
with op.batch_alter_table('addresses', schema=None) as batch_op: | ||
batch_op.create_index(batch_op.f('ix_addresses_city'), ['city'], unique=False) | ||
batch_op.create_index(batch_op.f('ix_addresses_street_address'), ['street_address'], unique=False) | ||
|
||
with op.batch_alter_table('registrations', schema=None) as batch_op: | ||
batch_op.create_index(batch_op.f('ix_registrations_status'), ['status'], unique=False) | ||
batch_op.create_index(batch_op.f('ix_registrations_submission_date'), ['submission_date'], unique=False) | ||
|
||
op.execute( | ||
""" | ||
CREATE INDEX ix_contacts_fullname ON contacts ( | ||
(firstname || ' ' || lastname) | ||
); | ||
""" | ||
) | ||
|
||
|
||
def downgrade(): | ||
with op.batch_alter_table('addresses', schema=None) as batch_op: | ||
op.drop_index('ix_addresses_street_address') | ||
op.drop_index('ix_addresses_city') | ||
|
||
with op.batch_alter_table('registrations', schema=None) as batch_op: | ||
op.drop_index('ix_registrations_submission_date') | ||
op.drop_index('ix_registrations_status') | ||
|
||
op.execute('DROP INDEX ix_contacts_fullname;') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.