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

CurrentPrivacyPreference > Special Purpose Unique Constraint Fix #4174

Merged
merged 6 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ The types of changes are:

### Fixed
- Allows CDN to cache empty experience responses from fides.js API [#4113](https://github.com/ethyca/fides/pull/4113)
- Fixed `identity_special_purpose` unique constraint definition [#4174](https://github.com/ethyca/fides/pull/4174/files)

## [2.20.2](https://github.com/ethyca/fides/compare/2.20.1...2.20.2)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""update_special_purpose_unique_constraint

Revision ID: 4cb3b5af4160
Revises: 8c54e1e5bdc4
Create Date: 2023-09-27 22:58:43.064996

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "4cb3b5af4160"
down_revision = "8c54e1e5bdc4"
branch_labels = None
depends_on = None


def upgrade():
op.drop_constraint(
"identity_special_purpose", "currentprivacypreference", type_="unique"
)
op.create_unique_constraint(
"identity_special_purpose",
"currentprivacypreference",
["provided_identity_id", "special_purpose"],
)


def downgrade():
op.drop_constraint(
"identity_special_purpose", "currentprivacypreference", type_="unique"
)
op.create_unique_constraint(
"identity_special_purpose",
"currentprivacypreference",
["provided_identity_id", "purpose"],
)
2 changes: 1 addition & 1 deletion src/fides/api/models/privacy_preference.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ class CurrentPrivacyPreference(LastSavedMixin, Base):
name="fides_user_device_identity_purpose",
),
UniqueConstraint(
"provided_identity_id", "purpose", name="identity_special_purpose"
"provided_identity_id", "special_purpose", name="identity_special_purpose"
),
UniqueConstraint(
"fides_user_device_provided_identity_id",
Expand Down
Loading