-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HJ-56 - Add RDS Postgres to ConnectorType (#5382)
- Loading branch information
1 parent
a268975
commit 2c6c1f2
Showing
1 changed file
with
104 additions
and
0 deletions.
There are no files selected for viewing
104 changes: 104 additions & 0 deletions
104
src/fides/api/alembic/migrations/versions/5dafbc1818ae_add_rds_postgres_to_connector_type.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,104 @@ | ||
"""add_rds_postgres_to_connector_type | ||
Revision ID: 5dafbc1818ae | ||
Revises: 49bdd2fff350 | ||
Create Date: 2024-10-15 14:14:59.651766 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "5dafbc1818ae" | ||
down_revision = "49bdd2fff350" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# Add 'rds_postgres' to ConnectionType enum | ||
op.execute("ALTER TYPE connectiontype RENAME TO connectiontype_old") | ||
op.execute( | ||
""" | ||
CREATE TYPE connectiontype AS ENUM ( | ||
'mongodb', | ||
'mysql', | ||
'https', | ||
'snowflake', | ||
'redshift', | ||
'mssql', | ||
'mariadb', | ||
'bigquery', | ||
'saas', | ||
'manual', | ||
'manual_webhook', | ||
'timescale', | ||
'fides', | ||
'sovrn', | ||
'attentive_email', | ||
'dynamodb', | ||
'postgres', | ||
'generic_consent_email', | ||
'generic_erasure_email', | ||
'scylla', | ||
's3', | ||
'google_cloud_sql_mysql', | ||
'google_cloud_sql_postgres', | ||
'dynamic_erasure_email', | ||
'rds_mysql', | ||
'rds_postgres' | ||
) | ||
""" | ||
) | ||
op.execute( | ||
""" | ||
ALTER TABLE connectionconfig ALTER COLUMN connection_type TYPE connectiontype USING | ||
connection_type::text::connectiontype | ||
""" | ||
) | ||
op.execute("DROP TYPE connectiontype_old") | ||
|
||
|
||
def downgrade(): | ||
# Remove 'rds_postgres' from ConnectionType enum | ||
op.execute("DELETE FROM connectionconfig WHERE connection_type IN ('rds_postgres')") | ||
op.execute("ALTER TYPE connectiontype RENAME TO connectiontype_old") | ||
op.execute( | ||
""" | ||
CREATE TYPE connectiontype AS ENUM ( | ||
'mongodb', | ||
'mysql', | ||
'https', | ||
'snowflake', | ||
'redshift', | ||
'mssql', | ||
'mariadb', | ||
'bigquery', | ||
'saas', | ||
'manual', | ||
'manual_webhook', | ||
'timescale', | ||
'fides', | ||
'sovrn', | ||
'attentive_email', | ||
'dynamodb', | ||
'postgres', | ||
'generic_consent_email', | ||
'generic_erasure_email', | ||
'scylla', | ||
's3', | ||
'google_cloud_sql_mysql', | ||
'google_cloud_sql_postgres', | ||
'dynamic_erasure_email', | ||
'rds_mysql' | ||
) | ||
""" | ||
) | ||
op.execute( | ||
""" | ||
ALTER TABLE connectionconfig ALTER COLUMN connection_type TYPE connectiontype USING | ||
connection_type::text::connectiontype | ||
""" | ||
) | ||
op.execute("DROP TYPE connectiontype_old") |