diff --git a/db_revisions/versions/26a742d97ad9_seed_federal_regulator_table.py b/db_revisions/versions/26a742d97ad9_seed_federal_regulator_table.py index c59316c..82f1f13 100644 --- a/db_revisions/versions/26a742d97ad9_seed_federal_regulator_table.py +++ b/db_revisions/versions/26a742d97ad9_seed_federal_regulator_table.py @@ -7,7 +7,7 @@ """ from typing import Sequence, Union from alembic import op -from sqlalchemy import MetaData, Table +from utils import get_table_by_name # revision identifiers, used by Alembic. @@ -28,16 +28,12 @@ def upgrade() -> None: {"id": "OTS", "name": "Office of Thrift Supervision (only valid until July 21, 2011)"}, ] - meta = MetaData() - meta.reflect(op.get_bind()) - table = Table("federal_regulator", meta) + table = get_table_by_name("federal_regulator") op.bulk_insert(table, seed_data) def downgrade() -> None: - meta = MetaData() - meta.reflect(op.get_bind()) - table = Table("federal_regulator", meta) + table = get_table_by_name("federal_regulator") op.execute(table.delete()) diff --git a/db_revisions/versions/7b6ff51002b5_seed_address_state_table.py b/db_revisions/versions/7b6ff51002b5_seed_address_state_table.py index 9ac1580..0168d99 100644 --- a/db_revisions/versions/7b6ff51002b5_seed_address_state_table.py +++ b/db_revisions/versions/7b6ff51002b5_seed_address_state_table.py @@ -7,7 +7,7 @@ """ from typing import Sequence, Union from alembic import op -from sqlalchemy import MetaData, Table +from utils import get_table_by_name # revision identifiers, used by Alembic. @@ -78,16 +78,12 @@ def upgrade() -> None: {"code": "VI", "name": "Virgin Islands, U.S."}, ] - meta = MetaData() - meta.reflect(op.get_bind()) - table = Table("address_state", meta) + table = get_table_by_name("address_state") op.bulk_insert(table, seed_data) def downgrade() -> None: - meta = MetaData() - meta.reflect(op.get_bind()) - table = Table("address_state", meta) + table = get_table_by_name("address_state") op.execute(table.delete()) diff --git a/db_revisions/versions/a41281b1e109_seed_sbl_institution_type_table.py b/db_revisions/versions/a41281b1e109_seed_sbl_institution_type_table.py index f8251ea..4125dc3 100644 --- a/db_revisions/versions/a41281b1e109_seed_sbl_institution_type_table.py +++ b/db_revisions/versions/a41281b1e109_seed_sbl_institution_type_table.py @@ -7,7 +7,7 @@ """ from typing import Sequence, Union from alembic import op -from sqlalchemy import MetaData, Table +from utils import get_table_by_name # revision identifiers, used by Alembic. revision: str = "a41281b1e109" @@ -33,16 +33,12 @@ def upgrade() -> None: {"id": "13", "name": "Other"}, ] - meta = MetaData() - meta.reflect(op.get_bind()) - table = Table("sbl_institution_type", meta) + table = get_table_by_name("sbl_institution_type") op.bulk_insert(table, seed_data) def downgrade() -> None: - meta = MetaData() - meta.reflect(op.get_bind()) - table = Table("sbl_institution_type", meta) + table = get_table_by_name("sbl_institution_type") op.execute(table.delete()) diff --git a/db_revisions/versions/f4ff7d1aa6df_seed_hmda_institution_type_table.py b/db_revisions/versions/f4ff7d1aa6df_seed_hmda_institution_type_table.py index 11d89b6..c099398 100644 --- a/db_revisions/versions/f4ff7d1aa6df_seed_hmda_institution_type_table.py +++ b/db_revisions/versions/f4ff7d1aa6df_seed_hmda_institution_type_table.py @@ -7,7 +7,7 @@ """ from typing import Sequence, Union from alembic import op -from sqlalchemy import MetaData, Table +from utils import get_table_by_name # revision identifiers, used by Alembic. @@ -38,16 +38,13 @@ def upgrade() -> None: {"id": "17", "name": "MBS of federally chartered thrift (OCC supervised)"}, {"id": "18", "name": "Affiliate of depository institution. MBS is in the same ownership org as a depository."}, ] - meta = MetaData() - meta.reflect(op.get_bind()) - table = Table("hmda_institution_type", meta) + + table = get_table_by_name("hmda_institution_type") op.bulk_insert(table, seed_data) def downgrade() -> None: - meta = MetaData() - meta.reflect(op.get_bind()) - table = Table("hmda_institution_type", meta) + table = get_table_by_name("hmda_institution_type") op.execute(table.delete())