-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make loan.patron_id and hold.patron_id fields non-nullable.
- Loading branch information
1 parent
14b4315
commit 69cd3e4
Showing
2 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
alembic/versions/20241119_58b0ae7f5b67_make_loan_patron_id_and_hold_patron_id_.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,43 @@ | ||
"""Make Loan.patron_id and Hold.patron_id non-nullable. | ||
Revision ID: 58b0ae7f5b67 | ||
Revises: 272da5f400de | ||
Create Date: 2024-11-19 18:04:24.182444+00:00 | ||
""" | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "58b0ae7f5b67" | ||
down_revision = "272da5f400de" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.alter_column( | ||
table_name="loans", | ||
column_name="patron_id", | ||
nullable=False, | ||
) | ||
|
||
op.alter_column( | ||
table_name="holds", | ||
column_name="patron_id", | ||
nullable=False, | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.alter_column( | ||
table_name="loans", | ||
column_name="patron_id", | ||
nullable=True, | ||
) | ||
|
||
op.alter_column( | ||
table_name="holds", | ||
column_name="patron_id", | ||
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