Skip to content

Commit

Permalink
Merge pull request #256 from Police-Data-Accessibility-Project/mc_590…
Browse files Browse the repository at this point in the history
…_non_null_agency_type

Add migration to make agency_type non-null
  • Loading branch information
maxachis authored Feb 11, 2025
2 parents 603ad28 + c833817 commit 21f55ea
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
28 changes: 28 additions & 0 deletions alembic/versions/83090d813802_make_agency_type_non_null.py
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)
12 changes: 11 additions & 1 deletion local_database/DataDumper/ENV.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,14 @@
| `DUMP_USER` | The username of the user to connect to the database. | `test_source_collector_user` |
| `DUMP_PASSWORD` | The password of the user to connect to the database. | `HanviliciousHamiltonHilltops` |
| `DUMP_DB_NAME` | The name of the database to dump. | `source_collector_test_db` |
| `DUMP_PORT` | The port of the database to dump. | `5432` |
| `DUMP_PORT` | The port of the database to dump. | `5432` |

Shell Script

```env
DUMP_HOST=127.0.0.1
DUMP_USER=test_source_collector_user
DUMP_PASSWORD=HanviliciousHamiltonHilltops
DUMP_DB_NAME=source_collector_test_db
DUMP_PORT=5432
```

0 comments on commit 21f55ea

Please sign in to comment.