This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds drp action type to db, adds docs, tests
- Loading branch information
1 parent
337065a
commit 3a97760
Showing
10 changed files
with
415 additions
and
16 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
40 changes: 40 additions & 0 deletions
40
src/migrations/versions/0e0b346819d7_adds_drp_policy_column_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_policy column to policy | ||
Revision ID: 0e0b346819d7 | ||
Revises: 530fb8533ca4 | ||
Create Date: 2022-04-28 20:36:01.314299 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
|
||
|
||
revision = "0e0b346819d7" | ||
down_revision = "530fb8533ca4" | ||
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.