-
Notifications
You must be signed in to change notification settings - Fork 23
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 #{[3860](#3860)} ### Time to review: __5 mins__ ## Changes proposed Added OpportunityVersion Model Added OpportunityVersionFactory Migration Script to create table --------- Co-authored-by: nava-platform-bot <[email protected]>
- Loading branch information
1 parent
8dcddc9
commit f586071
Showing
4 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
api/src/db/migrations/versions/2025_02_20_add_opportunity_version.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 @@ | ||
"""add opportunity version | ||
Revision ID: 20590d71bc20 | ||
Revises: d5f73aa58acb | ||
Create Date: 2025-02-20 17:46:56.068111 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "20590d71bc20" | ||
down_revision = "d5f73aa58acb" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"opportunity_version", | ||
sa.Column("opportunity_version_id", sa.UUID(), nullable=False), | ||
sa.Column("opportunity_id", sa.BigInteger(), nullable=False), | ||
sa.Column("opportunity_data", postgresql.JSONB(astext_type=sa.Text()), nullable=False), | ||
sa.Column( | ||
"created_at", | ||
sa.TIMESTAMP(timezone=True), | ||
server_default=sa.text("now()"), | ||
nullable=False, | ||
), | ||
sa.Column( | ||
"updated_at", | ||
sa.TIMESTAMP(timezone=True), | ||
server_default=sa.text("now()"), | ||
nullable=False, | ||
), | ||
sa.ForeignKeyConstraint( | ||
["opportunity_id"], | ||
["api.opportunity.opportunity_id"], | ||
name=op.f("opportunity_version_opportunity_id_opportunity_fkey"), | ||
), | ||
sa.PrimaryKeyConstraint( | ||
"opportunity_version_id", "opportunity_id", name=op.f("opportunity_version_pkey") | ||
), | ||
schema="api", | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table("opportunity_version", 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.