-
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.
migration to add s3 to db connection type enum
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
src/fides/api/alembic/migrations/versions/cb344673f633_add_s3_connection_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,53 @@ | ||
"""add s3 connection type | ||
Revision ID: cb344673f633 | ||
Revises: 4b2eade4353c | ||
Create Date: 2024-05-31 20:46:08.829330 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "cb344673f633" | ||
down_revision = "4b2eade4353c" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# Add 's3' 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', 'dynamodb', 'postgres'," | ||
"'generic_consent_email', 'generic_erasure_email', 's3')" | ||
) | ||
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 's3' from ConnectionType enum | ||
op.execute("delete from connectionconfig where connection_type in ('s3')") | ||
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', 'dynamodb', 'postgres'," | ||
"'generic_consent_email', 'generic_erasure_email')" | ||
) | ||
op.execute( | ||
( | ||
"alter table connectionconfig alter column connection_type type connectiontype using " | ||
"connection_type::text::connectiontype" | ||
) | ||
) | ||
op.execute("drop type connectiontype_old") |