Skip to content

Commit

Permalink
Merge pull request #328 from nsidc/addtional-add-link-fields
Browse files Browse the repository at this point in the history
Add additional link fields
  • Loading branch information
rmarow authored Oct 2, 2024
2 parents 47719c1 + e0b7f9d commit e65edbf
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
## v2.2.0 (2024-10-01)

* Allow nodes of same type to link
* Reverse color bar
* Allow nodes of same type to link.
* Reverse color bar.
* Add new link fields (db migration 925ed377e31b).

## v2.1.0 (2024-09-26)

* Increase length of description columns to 4096 chars.
* Increase length of description columns to 4096 chars (db migration fafa3da67d5e).


## v2.0.2 (2024-06-07)
Expand Down
24 changes: 24 additions & 0 deletions deploy/post/v2.2.0
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
64 changes: 64 additions & 0 deletions migrations/versions/925ed377e31b_add_new_link_fields.py
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 ###
4 changes: 4 additions & 0 deletions usaon_benefit_tool/models/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ class Link(BaseModel):
),
nullable=False,
)
performance_rating_rationale = Column(String(8192), nullable=True)
critically_rating_rationale = Column(String(8192), nullable=True)
gaps_description = Column(String(8192), nullable=True)
attribute_description = Column(String(512), nullable=True)

source_assessment_node = relationship(
AssessmentNode,
Expand Down

0 comments on commit e65edbf

Please sign in to comment.