-
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.
414- adds DRP action to Policy (#453)
* adds drp action type to db, adds docs, tests * fix lint, tests * format * remove unneeded func arg * lint * more lint * CR changes * update alembic down migration number * minor docs updates for drp * integration tests and updating alembic * catches integrity error at endpoint level * lint Co-authored-by: Cole Isaac <cole@ethyca.com>
- Loading branch information
1 parent
dd4aac8
commit b4d6f0b
Showing
10 changed files
with
373 additions
and
29 deletions.
There are no files selected for viewing
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
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
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
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
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
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
40 changes: 40 additions & 0 deletions
40
src/migrations/versions/5078badb90b9_adds_drp_action_to_policy.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,40 @@ | ||
"""adds DRP action to policy | ||
Revision ID: 5078badb90b9 | ||
Revises: c98da12d76f8 | ||
Create Date: 2022-05-04 17:22:46.500067 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
from sqlalchemy.dialects import postgresql | ||
|
||
revision = "5078badb90b9" | ||
down_revision = "c98da12d76f8" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
drpaction = postgresql.ENUM( | ||
"access", | ||
"deletion", | ||
"sale_opt_out", | ||
"sale_opt_in", | ||
"access_categories", | ||
"access_specific", | ||
name="drpaction", | ||
create_type=False, | ||
) | ||
drpaction.create(op.get_bind()) | ||
op.add_column("policy", sa.Column("drp_action", drpaction, nullable=True)) | ||
op.create_index(op.f("ix_policy_drp_action"), "policy", ["drp_action"], unique=True) | ||
|
||
|
||
def downgrade(): | ||
op.drop_index(op.f("ix_policy_drp_action"), table_name="policy") | ||
op.drop_column("policy", "drp_action") | ||
op.execute("DROP TYPE drpaction;") |
Oops, something went wrong.