-
Notifications
You must be signed in to change notification settings - Fork 16
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 #3291 ### Time to review: 5 mins ## Changes proposed Add a `user_saved_opportunity` table with columns as described in the ticket. ## Context for reviewers Needed for follow-on work with saved opportunity API tickets.
- Loading branch information
1 parent
9ce8c00
commit 2188831
Showing
4 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
api/src/db/migrations/versions/2024_12_19_create_user_saved_opportunity_table.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,56 @@ | ||
"""Create user saved opportunity table | ||
Revision ID: 232a9223ed9b | ||
Revises: 6a23520d2c3c | ||
Create Date: 2024-12-19 22:41:02.487364 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "232a9223ed9b" | ||
down_revision = "f8058a6c0a66" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"user_saved_opportunity", | ||
sa.Column("user_id", sa.UUID(), nullable=False), | ||
sa.Column("opportunity_id", sa.BigInteger(), 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( | ||
["user_id"], ["api.user.user_id"], name=op.f("user_saved_opportunity_user_id_user_fkey") | ||
), | ||
sa.ForeignKeyConstraint( | ||
["opportunity_id"], | ||
["api.opportunity.opportunity_id"], | ||
name=op.f("user_saved_opportunity_opportunity_id_opportunity_fkey"), | ||
), | ||
sa.PrimaryKeyConstraint( | ||
"user_id", "opportunity_id", name=op.f("user_saved_opportunity_pkey") | ||
), | ||
schema="api", | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table("user_saved_opportunity", 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.