-
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 #256 from Police-Data-Accessibility-Project/mc_590…
…_non_null_agency_type Add migration to make agency_type non-null
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
alembic/versions/83090d813802_make_agency_type_non_null.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,28 @@ | ||
"""make_agency_type_non_null | ||
Revision ID: 83090d813802 | ||
Revises: 94da2c95b58d | ||
Create Date: 2025-02-11 10:05:49.486152 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = '83090d813802' | ||
down_revision: Union[str, None] = '94da2c95b58d' | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# Add non-null constraint to agency_type | ||
op.alter_column('agencies', 'agency_type', nullable=False) | ||
|
||
|
||
def downgrade() -> None: | ||
# Remove non-null constraint from agency_type | ||
op.alter_column('agencies', 'agency_type', nullable=True) |
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