From 491714c13d58c1e97d230654788fdd3b8a343bb7 Mon Sep 17 00:00:00 2001 From: Sean Preston Date: Fri, 21 Apr 2023 17:11:32 -0400 Subject: [PATCH] adds fides_user_device_id to ProvidedIdentityType Enum --- .../3842d1acac5f_adds_fides_device_id_enum.py | 37 +++++++++++++++++++ src/fides/api/ops/models/privacy_request.py | 1 + 2 files changed, 38 insertions(+) create mode 100644 src/fides/api/ctl/migrations/versions/3842d1acac5f_adds_fides_device_id_enum.py diff --git a/src/fides/api/ctl/migrations/versions/3842d1acac5f_adds_fides_device_id_enum.py b/src/fides/api/ctl/migrations/versions/3842d1acac5f_adds_fides_device_id_enum.py new file mode 100644 index 00000000000..236941a139c --- /dev/null +++ b/src/fides/api/ctl/migrations/versions/3842d1acac5f_adds_fides_device_id_enum.py @@ -0,0 +1,37 @@ +"""adds fides_user_device_id enum + +Revision ID: 3842d1acac5f +Revises: 8342453518cc +Create Date: 2023-04-21 20:10:01.389078 + +""" +from alembic import op + + +# revision identifiers, used by Alembic. +revision = "3842d1acac5f" +down_revision = "8342453518cc" +branch_labels = None +depends_on = None + + +def upgrade(): + op.execute("ALTER TYPE providedidentitytype RENAME TO providedidentitytype_old") + op.execute( + "CREATE TYPE providedidentitytype AS ENUM('email', 'phone_number', 'ga_client_id', 'ljt_readerID', 'fides_user_device_id')" + ) + op.execute( + "ALTER TABLE providedidentity ALTER COLUMN field_name TYPE providedidentitytype USING field_name::text::providedidentitytype" + ) + op.execute("DROP TYPE providedidentitytype_old") + + +def downgrade(): + op.execute("ALTER TYPE providedidentitytype RENAME TO providedidentitytype_old") + op.execute( + "CREATE TYPE providedidentitytype AS ENUM('email', 'phone_number', 'ga_client_id', 'ljt_readerID')" + ) + op.execute( + "ALTER TABLE providedidentity ALTER COLUMN field_name TYPE providedidentitytype USING field_name::text::providedidentitytype" + ) + op.execute("DROP TYPE providedidentitytype_old") diff --git a/src/fides/api/ops/models/privacy_request.py b/src/fides/api/ops/models/privacy_request.py index 09649585139..7116f445d79 100644 --- a/src/fides/api/ops/models/privacy_request.py +++ b/src/fides/api/ops/models/privacy_request.py @@ -812,6 +812,7 @@ class ProvidedIdentityType(EnumType): phone_number = "phone_number" ga_client_id = "ga_client_id" ljt_readerID = "ljt_readerID" + fides_user_device_id = "fides_user_device_id" class ProvidedIdentity(Base): # pylint: disable=R0904