-
Notifications
You must be signed in to change notification settings - Fork 3
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 #328 from nsidc/addtional-add-link-fields
Add additional link fields
- Loading branch information
Showing
4 changed files
with
96 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
# HACK: Garrison doesn't see these variables that were exported in main deploy | ||
# script, which is unintuitive. NOTE that sourcing VERSION.env is not | ||
# compatible with integration, but this script doesn't receive the environment | ||
# as a parameter. Garrison needs some extra thought here. | ||
source /etc/profile.d/envvars.sh | ||
source VERSION.env | ||
|
||
# TODO: figure out better way | ||
echo "Waiting 10 seconds for the new stack to come up..." | ||
sleep 10 | ||
|
||
docker compose run --rm usaon-benefit-tool alembic upgrade head | ||
|
||
# confirm the expected migration was applied | ||
current=$(docker compose run --rm usaon-benefit-tool alembic current 2>/dev/null) | ||
if [ "925ed377e31b (head)" = "${current}" ]; then | ||
echo "Data migration successful. On expected revision ${current}." | ||
else | ||
echo "Data migration failed. On unexpected revision ${current}." | ||
fi |
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,64 @@ | ||
"""Add new link fields. | ||
Revision ID: 925ed377e31b | ||
Revises: fafa3da67d5e | ||
Create Date: 2024-10-02 16:17:16.949764 | ||
""" | ||
|
||
from collections.abc import Sequence | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = '925ed377e31b' | ||
down_revision: str | None = 'fafa3da67d5e' | ||
branch_labels: str | Sequence[str] | None = None | ||
depends_on: str | Sequence[str] | None = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column( | ||
'link', | ||
sa.Column( | ||
'performance_rating_rationale', | ||
sa.String(length=8192), | ||
nullable=True, | ||
), | ||
) | ||
op.add_column( | ||
'link', | ||
sa.Column( | ||
'critically_rating_rationale', | ||
sa.String(length=8192), | ||
nullable=True, | ||
), | ||
) | ||
op.add_column( | ||
'link', | ||
sa.Column( | ||
'gaps_description', | ||
sa.String(length=8192), | ||
nullable=True, | ||
), | ||
) | ||
op.add_column( | ||
'link', | ||
sa.Column( | ||
'attribute_description', | ||
sa.String(length=512), | ||
nullable=True, | ||
), | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column('link', 'attribute_description') | ||
op.drop_column('link', 'gaps_description') | ||
op.drop_column('link', 'critically_rating_rationale') | ||
op.drop_column('link', 'performance_rating_rationale') | ||
# ### end Alembic commands ### |
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