Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue #2553] Cleanup v0 and v0.1 opportunity endpoints (backend/db) [3/3] #3411

Merged
merged 11 commits into from
Jan 9, 2025
Merged
76 changes: 0 additions & 76 deletions api/src/data_migration/copy_oracle_data.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
"""Remove TransferTopportunity models

Revision ID: 99bb8e01ad38
Revises: 232a9223ed9b
Create Date: 2025-01-06 21:25:41.127922

"""

import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = "99bb8e01ad38"
down_revision = "232a9223ed9b"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(
"transfer_topportunity_is_draft_idx", table_name="transfer_topportunity", schema="api"
)
op.drop_index(
"transfer_topportunity_oppcategory_idx", table_name="transfer_topportunity", schema="api"
)
op.drop_index(
"transfer_topportunity_opptitle_idx", table_name="transfer_topportunity", schema="api"
)
op.drop_table("transfer_topportunity", schema="api")
op.alter_column(
"user_saved_opportunity",
"opportunity_id",
existing_type=sa.INTEGER(),
type_=sa.BigInteger(),
existing_nullable=False,
schema="api",
)
op.create_foreign_key(
op.f("user_saved_opportunity_opportunity_id_opportunity_fkey"),
"user_saved_opportunity",
"opportunity",
["opportunity_id"],
["opportunity_id"],
source_schema="api",
referent_schema="api",
)
# ### end Alembic commands ###
mikehgrantsgov marked this conversation as resolved.
Show resolved Hide resolved


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(
op.f("user_saved_opportunity_opportunity_id_opportunity_fkey"),
"user_saved_opportunity",
schema="api",
type_="foreignkey",
)
op.alter_column(
"user_saved_opportunity",
"opportunity_id",
existing_type=sa.BigInteger(),
type_=sa.INTEGER(),
existing_nullable=False,
schema="api",
)
op.create_table(
"transfer_topportunity",
sa.Column("opportunity_id", sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column("oppnumber", sa.VARCHAR(length=160), autoincrement=False, nullable=True),
sa.Column("opptitle", sa.VARCHAR(length=1020), autoincrement=False, nullable=True),
sa.Column("owningagency", sa.VARCHAR(length=1020), autoincrement=False, nullable=True),
sa.Column("oppcategory", sa.VARCHAR(length=4), autoincrement=False, nullable=True),
sa.Column(
"category_explanation", sa.VARCHAR(length=1020), autoincrement=False, nullable=True
),
sa.Column("is_draft", sa.VARCHAR(length=4), autoincrement=False, nullable=False),
sa.Column("revision_number", sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column("modified_comments", sa.VARCHAR(length=4000), autoincrement=False, nullable=True),
sa.Column("publisheruid", sa.VARCHAR(length=1020), autoincrement=False, nullable=True),
sa.Column("publisher_profile_id", sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column("last_upd_id", sa.VARCHAR(length=200), autoincrement=False, nullable=True),
sa.Column("last_upd_date", sa.DATE(), autoincrement=False, nullable=True),
sa.Column("creator_id", sa.VARCHAR(length=200), autoincrement=False, nullable=True),
sa.Column("created_date", sa.DATE(), autoincrement=False, nullable=True),
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="transfer_topportunity_pkey"),
schema="api",
)
op.create_index(
"transfer_topportunity_opptitle_idx",
"transfer_topportunity",
["opptitle"],
unique=False,
schema="api",
)
op.create_index(
"transfer_topportunity_oppcategory_idx",
"transfer_topportunity",
["oppcategory"],
unique=False,
schema="api",
)
op.create_index(
"transfer_topportunity_is_draft_idx",
"transfer_topportunity",
["is_draft"],
unique=False,
schema="api",
)
# ### end Alembic commands ###
2 changes: 0 additions & 2 deletions api/src/db/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging

from . import agency_models, base, extract_models, lookup_models, opportunity_models, user_models
from .transfer import topportunity_models

logger = logging.getLogger(__name__)

Expand All @@ -13,7 +12,6 @@
"metadata",
"opportunity_models",
"lookup_models",
"topportunity_models",
"agency_models",
"user_models",
"extract_models",
Expand Down
42 changes: 0 additions & 42 deletions api/src/db/models/transfer/topportunity_models.py

This file was deleted.

109 changes: 0 additions & 109 deletions api/tests/src/data_migration/test_copy_oracle_data.py

This file was deleted.

Loading
Loading