-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
## Summary Fixes #1752 ### Time to review: __3 mins__ ## Changes proposed Two minor adjustments to the db schema: * Fixed the type of the revision number in the opportunity table (should be an integer not a string) * Added version_number, a missing column to the opportunity summary table ## Additional information Was able to load in data to the tables and run `make db-migrate` and `make db-migrate-down` uneventfully.
- Loading branch information
Showing
3 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
api/src/db/migrations/versions/2024_04_19_fix_column_type_and_add_version_number.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,49 @@ | ||
"""fix column type and add version number | ||
Revision ID: c6878bae0c60 | ||
Revises: b26ea0f40066 | ||
Create Date: 2024-04-19 13:41:34.017203 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "c6878bae0c60" | ||
down_revision = "b26ea0f40066" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.alter_column( | ||
"opportunity", | ||
"revision_number", | ||
existing_type=sa.TEXT(), | ||
type_=sa.Integer(), | ||
existing_nullable=True, | ||
postgresql_using="revision_number::integer", | ||
schema="api", | ||
) | ||
op.add_column( | ||
"opportunity_summary", | ||
sa.Column("version_number", sa.Integer(), nullable=True), | ||
schema="api", | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column("opportunity_summary", "version_number", schema="api") | ||
op.alter_column( | ||
"opportunity", | ||
"revision_number", | ||
existing_type=sa.Integer(), | ||
type_=sa.TEXT(), | ||
existing_nullable=True, | ||
postgresql_using="revision_number::TEXT", | ||
schema="api", | ||
) | ||
# ### 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
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