-
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.
Adding comments and document_num to sanctaury model and schema (#137)
Problem Sanctuary would like these two attributes added Solution - added document_num and comment to sanctuary model and schema - added migration file Ticket URL https://mediform.atlassian.net/browse/MEDI-90 Documentation NA Tests Run - make testapi - tested running migrations in dev environment
- Loading branch information
1 parent
f1508d0
commit b812227
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
app/api/alembic/sanctuary/versions/2024-03-22_5a6e3d13358f_document_num_and_comment.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,55 @@ | ||
"""CHANGEME | ||
Revision ID: 5a6e3d13358f | ||
Revises: 38ecd95d6104 | ||
Create Date: 2024-03-22 18:05:23.388169 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
from alembic import context | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '5a6e3d13358f' | ||
down_revision = '38ecd95d6104' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
schema_upgrades() | ||
if context.get_x_argument(as_dictionary=True).get("data", None): | ||
data_upgrades() | ||
|
||
|
||
def downgrade(): | ||
if context.get_x_argument(as_dictionary=True).get("data", None): | ||
data_downgrades() | ||
schema_downgrades() | ||
|
||
|
||
def schema_upgrades(): | ||
"""schema upgrade migrations go here.""" | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('intakes', sa.Column('document_num', sa.String(), nullable=True)) | ||
op.add_column('intakes', sa.Column('comment', sa.String(), nullable=True)) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def schema_downgrades(): | ||
"""schema downgrade migrations go here.""" | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column('intakes', 'comment') | ||
op.drop_column('intakes', 'document_num') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def data_upgrades(): | ||
"""Add any optional data upgrade migrations here!""" | ||
pass | ||
|
||
|
||
def data_downgrades(): | ||
"""Add any optional data downgrade migrations here!""" | ||
pass |
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
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