-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename opportunity table to use our naming schema (#767)
- Loading branch information
Showing
3 changed files
with
82 additions
and
15 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
api/src/db/migrations/versions/2023_11_27_rename_opportunity_table_prior_to_real_.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,74 @@ | ||
"""rename opportunity table prior to real usage | ||
Revision ID: dec1422eee27 | ||
Revises: fdd9312633d8 | ||
Create Date: 2023-11-27 14:43:04.227044 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "dec1422eee27" | ||
down_revision = "fdd9312633d8" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"opportunity", | ||
sa.Column("opportunity_id", sa.Integer(), nullable=False), | ||
sa.Column("opportunity_number", sa.Text(), nullable=True), | ||
sa.Column("opportunity_title", sa.Text(), nullable=True), | ||
sa.Column("agency", sa.Text(), nullable=True), | ||
sa.Column("category", sa.Text(), nullable=True), | ||
sa.Column("is_draft", sa.Boolean(), 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.PrimaryKeyConstraint("opportunity_id", name=op.f("opportunity_pkey")), | ||
) | ||
op.drop_table("topportunity") | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"topportunity", | ||
sa.Column("opportunity_id", sa.INTEGER(), autoincrement=True, nullable=False), | ||
sa.Column("oppnumber", sa.TEXT(), autoincrement=False, nullable=True), | ||
sa.Column("opptitle", sa.TEXT(), autoincrement=False, nullable=True), | ||
sa.Column("owningagency", sa.TEXT(), autoincrement=False, nullable=True), | ||
sa.Column("oppcategory", sa.TEXT(), autoincrement=False, nullable=True), | ||
sa.Column("is_draft", sa.BOOLEAN(), autoincrement=False, nullable=False), | ||
sa.Column( | ||
"created_at", | ||
postgresql.TIMESTAMP(timezone=True), | ||
server_default=sa.text("now()"), | ||
autoincrement=False, | ||
nullable=False, | ||
), | ||
sa.Column( | ||
"updated_at", | ||
postgresql.TIMESTAMP(timezone=True), | ||
server_default=sa.text("now()"), | ||
autoincrement=False, | ||
nullable=False, | ||
), | ||
sa.PrimaryKeyConstraint("opportunity_id", name="topportunity_pkey"), | ||
) | ||
op.drop_table("opportunity") | ||
# ### 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