Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""Eliminate Contact Info and Agency Meta Record Type

Revision ID: 43077d7e08c5
Revises: 51bde16e22f7
Create Date: 2025-10-12 20:36:17.965218

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

Check warning on line 11 in alembic/versions/2025_10_12_2036-43077d7e08c5_eliminate_contact_info_and_agency_meta_.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_10_12_2036-43077d7e08c5_eliminate_contact_info_and_agency_meta_.py#L11 <401>

'sqlalchemy as sa' imported but unused
Raw output
./alembic/versions/2025_10_12_2036-43077d7e08c5_eliminate_contact_info_and_agency_meta_.py:11:1: F401 'sqlalchemy as sa' imported but unused

from src.util.alembic_helpers import remove_enum_value

# revision identifiers, used by Alembic.
revision: str = '43077d7e08c5'
down_revision: Union[str, None] = '51bde16e22f7'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:

Check warning on line 22 in alembic/versions/2025_10_12_2036-43077d7e08c5_eliminate_contact_info_and_agency_meta_.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_10_12_2036-43077d7e08c5_eliminate_contact_info_and_agency_meta_.py#L22 <103>

Missing docstring in public function
Raw output
./alembic/versions/2025_10_12_2036-43077d7e08c5_eliminate_contact_info_and_agency_meta_.py:22:1: D103 Missing docstring in public function
op.execute(
"""DELETE FROM URL_RECORD_TYPE WHERE RECORD_TYPE = 'Contact Info & Agency Meta'"""
)
op.execute(
"""DELETE FROM auto_record_type_suggestions WHERE record_type = 'Contact Info & Agency Meta'"""
)
op.execute(
"""DELETE FROM user_record_type_suggestions WHERE record_type = 'Contact Info & Agency Meta'"""
)

remove_enum_value(
enum_name="record_type",
value_to_remove="Contact Info & Agency Meta",
targets=[
("url_record_type", "record_type"),
("auto_record_type_suggestions", "record_type"),
("user_record_type_suggestions", "record_type")
]
)


def downgrade() -> None:

Check warning on line 44 in alembic/versions/2025_10_12_2036-43077d7e08c5_eliminate_contact_info_and_agency_meta_.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] alembic/versions/2025_10_12_2036-43077d7e08c5_eliminate_contact_info_and_agency_meta_.py#L44 <103>

Missing docstring in public function
Raw output
./alembic/versions/2025_10_12_2036-43077d7e08c5_eliminate_contact_info_and_agency_meta_.py:44:1: D103 Missing docstring in public function
pass
8 changes: 0 additions & 8 deletions src/api/endpoints/annotate/all/post/models/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,3 @@ def forbid_all_else_if_not_relevant(self):
raise FailedValidationException("location_ids must be empty if suggested_status is NOT RELEVANT")
return self


@model_validator(mode="after")
def deprecate_agency_meta_url_record_type(self):
if self.record_type is None:
return self
if self.record_type == RecordType.CONTACT_INFO_AND_AGENCY_META:
raise FailedValidationException("Contact Info & Agency Meta Record Type is Deprecated.")
return self
2 changes: 0 additions & 2 deletions src/core/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class RecordType(Enum):
# Info About Agencies
ANNUAL_AND_MONTHLY_REPORTS = "Annual & Monthly Reports"
BUDGETS_AND_FINANCES = "Budgets & Finances"
# TODO SM422: Remove below
CONTACT_INFO_AND_AGENCY_META = "Contact Info & Agency Meta"
GEOGRAPHIC = "Geographic"
LIST_OF_DATA_SOURCES = "List of Data Sources"
POLICIES_AND_CONTRACTS = "Policies & Contracts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
# Info About Agencies
RecordType.ANNUAL_AND_MONTHLY_REPORTS: RecordTypeCoarse.INFO_ABOUT_AGENCIES,
RecordType.BUDGETS_AND_FINANCES: RecordTypeCoarse.INFO_ABOUT_AGENCIES,
RecordType.CONTACT_INFO_AND_AGENCY_META: RecordTypeCoarse.INFO_ABOUT_AGENCIES,
RecordType.GEOGRAPHIC: RecordTypeCoarse.INFO_ABOUT_AGENCIES,
RecordType.LIST_OF_DATA_SOURCES: RecordTypeCoarse.INFO_ABOUT_AGENCIES,
RecordType.POLICIES_AND_CONTRACTS: RecordTypeCoarse.INFO_ABOUT_AGENCIES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,3 @@ def forbid_all_else_if_not_relevant(self):
return self


@model_validator(mode="after")
def deprecate_agency_meta_url_record_type(self):
if self.record_type is None:
return self
if self.record_type == RecordType.CONTACT_INFO_AND_AGENCY_META:
raise FailedValidationException("Contact Info & Agency Meta Record Type is Deprecated.")
return self