Skip to content

Commit

Permalink
[Issue 1311] Cleanup DMS table we no longer need (#1313)
Browse files Browse the repository at this point in the history
## Summary
Fixes #1311

### Time to review: __3 mins__

## Changes proposed
Delete the `awsdms_apply_exceptions` that we had setup for DMS

## Context for reviewers
We needed this table for DMS to function properly, but we have decided
not to use DMS, so cleanup the table creation in Alembic.

If we want, we could later delete this and the other migration entirely,
but we need to cleanup the environments this change may have been
deployed in previously.

## Additional information
Running locally, the table goes away after we run the migration:
![Screenshot 2024-02-21 at 2 17 49
PM](https://github.com/HHS/simpler-grants-gov/assets/46358556/f0d48fe4-e4a1-432a-88a9-cf1bedb5adb9)

and running the down migrations makes it return:
![Screenshot 2024-02-21 at 2 18 51
PM](https://github.com/HHS/simpler-grants-gov/assets/46358556/388d4560-af88-46f5-8f99-31246d3c57c7)
  • Loading branch information
chouinar authored Feb 22, 2024
1 parent 20fd800 commit fcae6c5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
5 changes: 0 additions & 5 deletions api/src/db/migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ def include_object(
) -> bool:
if type_ == "schema" and getattr(object, "schema", None) is not None:
return False
elif type_ == "table" and name == "awsdms_apply_exceptions":
# We make this table separately from SQLAlchemy - so ignore it in
# any auto-generation checks otherwise Alembic thinks the table should
# be deleted.
return False
else:
return True

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""remove DMS exceptions table
Revision ID: 5d58c38f2cac
Revises: 86edfcb92a66
Create Date: 2024-02-21 13:44:50.932948
"""
from alembic import op

# revision identifiers, used by Alembic.
revision = "5d58c38f2cac"
down_revision = "86edfcb92a66"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.execute("DROP TABLE IF EXISTS awsdms_apply_exceptions")
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.execute(
"""
CREATE TABLE IF NOT EXISTS awsdms_apply_exceptions (
ERROR_TIME timestamp NOT NULL,
TASK_NAME varchar(128) NOT NULL,
TABLE_OWNER varchar(128) NOT NULL,
TABLE_NAME varchar(128) NOT NULL,
STATEMENT text NOT NULL,
ERROR text NOT NULL
);
"""
)
# ### end Alembic commands ###

0 comments on commit fcae6c5

Please sign in to comment.