-
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.
Updated DAO, added migration, model_validator, and pytests (#114)
Closes #113 - Updated FinancialInstitutionDAO.tax_id to be 10 characters - Updated alembic script to change financial_institutions and financial_institutions_history tables tax_id column to be 10 characters - Added model_validator to FinancialInstitutionDTO to check regex on tax_id - Added pytest to check for invalid tax_id - Updated existing tax_id fields in pytests to contain the dash
- Loading branch information
Showing
8 changed files
with
101 additions
and
14 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
db_revisions/versions/0e520c01fb42_update_tax_id_to_10_characters.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,32 @@ | ||
"""update tax-id to 10 characters | ||
Revision ID: 0e520c01fb42 | ||
Revises: 8106d83ff594 | ||
Create Date: 2024-03-12 11:40:25.790658 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "0e520c01fb42" | ||
down_revision: Union[str, None] = "8106d83ff594" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
with op.batch_alter_table("financial_institutions") as batch_op: | ||
batch_op.alter_column("tax_id", existing_type=sa.String(9), type_=sa.String(10)) | ||
with op.batch_alter_table("financial_institutions_history") as batch_op: | ||
batch_op.alter_column("tax_id", existing_type=sa.String(9), type_=sa.String(10)) | ||
|
||
|
||
def downgrade() -> None: | ||
with op.batch_alter_table("financial_institutions") as batch_op: | ||
batch_op.alter_column("tax_id", existing_type=sa.String(10), type_=sa.String(9)) | ||
with op.batch_alter_table("financial_institutions_history") as batch_op: | ||
batch_op.alter_column("tax_id", existing_type=sa.String(10), type_=sa.String(9)) |
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