-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 68-update-institutions-table-and-daos-instit…
…ution-type-fields
- Loading branch information
Showing
31 changed files
with
531 additions
and
348 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
Empty file.
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,22 @@ | ||
#!/bin/sh | ||
|
||
if [[ $1 == "" ]] | ||
then | ||
echo "No arguments passed!" | ||
echo "The argument must be either reset or reset-then-seed" | ||
exit 0 | ||
fi | ||
|
||
ACTION=$1 | ||
|
||
if [ $ACTION == "reset" ] | ||
then | ||
#If only need to reset db | ||
poetry run alembic downgrade base | ||
elif [ $ACTION == "reset-then-seed" ] | ||
then | ||
#First reset the db | ||
poetry run alembic downgrade base | ||
#Then upgrade it to head | ||
poetry run alembic upgrade head | ||
fi |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
28 changes: 0 additions & 28 deletions
28
db_revisions/versions/26a742d97ad9_feed_federal_regulator_table.py
This file was deleted.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
db_revisions/versions/26a742d97ad9_seed_federal_regulator_table.py
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,41 @@ | ||
"""Seed Federal Regulator table | ||
Revision ID: 26a742d97ad9 | ||
Revises: 7b6ff51002b5 | ||
Create Date: 2023-12-14 01:23:17.872728 | ||
""" | ||
from typing import Sequence, Union | ||
from alembic import op | ||
from db_revisions.utils import get_table_by_name, get_indices_from_collection | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "26a742d97ad9" | ||
down_revision: Union[str, None] = "7b6ff51002b5" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
seed_data = [ | ||
{"id": "FCA", "name": "Farm Credit Administration"}, | ||
{"id": "FDIC", "name": "Federal Deposit Insurance Corporation"}, | ||
{"id": "FHFA", "name": "Federal Housing Finance Agency"}, | ||
{"id": "FRS", "name": "Federal Reserve System"}, | ||
{"id": "NCUA", "name": "National Credit Union Administration"}, | ||
{"id": "OCC", "name": "Office of the Comptroller of the Currency"}, | ||
{"id": "OTS", "name": "Office of Thrift Supervision (only valid until July 21, 2011)"}, | ||
] | ||
|
||
|
||
def upgrade() -> None: | ||
table = get_table_by_name("federal_regulator") | ||
|
||
op.bulk_insert(table, seed_data) | ||
|
||
|
||
def downgrade() -> None: | ||
table = get_table_by_name("federal_regulator") | ||
|
||
ids = get_indices_from_collection(seed_data, "id") | ||
|
||
op.execute(table.delete().where(table.c.id.in_(ids))) |
28 changes: 0 additions & 28 deletions
28
db_revisions/versions/7b6ff51002b5_feed_address_state_table.py
This file was deleted.
Oops, something went wrong.
91 changes: 91 additions & 0 deletions
91
db_revisions/versions/7b6ff51002b5_seed_address_state_table.py
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,91 @@ | ||
"""Seed Address State table | ||
Revision ID: 7b6ff51002b5 | ||
Revises: 045aa502e050 | ||
Create Date: 2023-12-14 01:21:48.325752 | ||
""" | ||
from typing import Sequence, Union | ||
from alembic import op | ||
from db_revisions.utils import get_table_by_name, get_indices_from_collection | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "7b6ff51002b5" | ||
down_revision: Union[str, None] = "045aa502e050" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
seed_data = [ | ||
{"code": "AL", "name": "Alabama"}, | ||
{"code": "AK", "name": "Alaska"}, | ||
{"code": "AZ", "name": "Arizona"}, | ||
{"code": "AR", "name": "Arkansas"}, | ||
{"code": "CA", "name": "California"}, | ||
{"code": "CO", "name": "Colorado"}, | ||
{"code": "CT", "name": "Connecticut"}, | ||
{"code": "DE", "name": "Delaware"}, | ||
{"code": "FL", "name": "Florida"}, | ||
{"code": "GA", "name": "Georgia"}, | ||
{"code": "HI", "name": "Hawaii"}, | ||
{"code": "ID", "name": "Idaho"}, | ||
{"code": "IL", "name": "Illinois"}, | ||
{"code": "IN", "name": "Indiana"}, | ||
{"code": "IA", "name": "Iowa"}, | ||
{"code": "KS", "name": "Kansas"}, | ||
{"code": "KY", "name": "Kentucky"}, | ||
{"code": "LA", "name": "Louisiana"}, | ||
{"code": "ME", "name": "Maine"}, | ||
{"code": "MD", "name": "Maryland"}, | ||
{"code": "MA", "name": "Massachusetts"}, | ||
{"code": "MI", "name": "Michigan"}, | ||
{"code": "MN", "name": "Minnesota"}, | ||
{"code": "MS", "name": "Mississippi"}, | ||
{"code": "MO", "name": "Missouri"}, | ||
{"code": "MT", "name": "Montana"}, | ||
{"code": "NE", "name": "Nebraska"}, | ||
{"code": "NV", "name": "Nevada"}, | ||
{"code": "NH", "name": "New Hampshire"}, | ||
{"code": "NJ", "name": "New Jersey"}, | ||
{"code": "NM", "name": "New Mexico"}, | ||
{"code": "NY", "name": "New York"}, | ||
{"code": "NC", "name": "North Carolina"}, | ||
{"code": "ND", "name": "North Dakota"}, | ||
{"code": "OH", "name": "Ohio"}, | ||
{"code": "OK", "name": "Oklahoma"}, | ||
{"code": "OR", "name": "Oregon"}, | ||
{"code": "PA", "name": "Pennsylvania"}, | ||
{"code": "RI", "name": "Rhode Island"}, | ||
{"code": "SC", "name": "South Carolina"}, | ||
{"code": "SD", "name": "South Dakota"}, | ||
{"code": "TN", "name": "Tennessee"}, | ||
{"code": "TX", "name": "Texas"}, | ||
{"code": "UT", "name": "Utah"}, | ||
{"code": "VT", "name": "Vermont"}, | ||
{"code": "VA", "name": "Virginia"}, | ||
{"code": "WA", "name": "Washington"}, | ||
{"code": "WV", "name": "West Virginia"}, | ||
{"code": "WI", "name": "Wisconsin"}, | ||
{"code": "WY", "name": "Wyoming"}, | ||
{"code": "DC", "name": "District of Columbia"}, | ||
{"code": "AS", "name": "American Samoa"}, | ||
{"code": "GU", "name": "Guam"}, | ||
{"code": "MP", "name": "Northern Mariana Islands"}, | ||
{"code": "PR", "name": "Puerto Rico"}, | ||
{"code": "UM", "name": "United States Minor Outlying Islands"}, | ||
{"code": "VI", "name": "Virgin Islands, U.S."}, | ||
] | ||
|
||
|
||
def upgrade() -> None: | ||
table = get_table_by_name("address_state") | ||
|
||
op.bulk_insert(table, seed_data) | ||
|
||
|
||
def downgrade() -> None: | ||
table = get_table_by_name("address_state") | ||
|
||
codes = get_indices_from_collection(seed_data, "code") | ||
|
||
op.execute(table.delete().where(table.c.code.in_(codes))) |
27 changes: 0 additions & 27 deletions
27
db_revisions/versions/a41281b1e109_feed_sbl_institution_type_table.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.