forked from getredash/redash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* master: Increased waiting time to avoid flakiness (getredash#5370) Updated axios (getredash#5371) Bump axios from 0.19.0 to 0.21.1 (getredash#5366) Bump bl from 1.2.2 to 1.2.3 in /viz-lib (getredash#5257) Bump dompurify from 2.0.8 to 2.0.17 in /viz-lib (getredash#5326) Fix for Cypress flakiness generated by param_spec (getredash#5349) Fix: add a merge migration to solve multi head issue (getredash#5364) Remove unnecessary space in rq log (getredash#5345) Encrypt alert notification destinations (getredash#5317) Use legacy resolver in pip to fix broken build (getredash#5309)
- Loading branch information
Showing
11 changed files
with
234 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""fix_multiple_heads | ||
Revision ID: 89bc7873a3e0 | ||
Revises: 0ec979123ba4, d7d747033183 | ||
Create Date: 2021-01-21 18:11:04.312259 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '89bc7873a3e0' | ||
down_revision = ('0ec979123ba4', 'd7d747033183') | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
pass | ||
|
||
|
||
def downgrade(): | ||
pass |
64 changes: 64 additions & 0 deletions
64
migrations/versions/d7d747033183_encrypt_alert_destinations.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,64 @@ | ||
"""encrypt alert destinations | ||
Revision ID: d7d747033183 | ||
Revises: e5c7a4e2df4d | ||
Create Date: 2020-12-14 21:42:48.661684 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
from sqlalchemy.sql import table | ||
from sqlalchemy_utils.types.encrypted.encrypted_type import FernetEngine | ||
|
||
from redash import settings | ||
from redash.utils.configuration import ConfigurationContainer | ||
from redash.models.base import key_type | ||
from redash.models.types import ( | ||
EncryptedConfiguration, | ||
Configuration, | ||
) | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'd7d747033183' | ||
down_revision = 'e5c7a4e2df4d' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.add_column( | ||
"notification_destinations", | ||
sa.Column("encrypted_options", postgresql.BYTEA(), nullable=True) | ||
) | ||
|
||
# copy values | ||
notification_destinations = table( | ||
"notification_destinations", | ||
sa.Column("id", key_type("NotificationDestination"), primary_key=True), | ||
sa.Column( | ||
"encrypted_options", | ||
ConfigurationContainer.as_mutable( | ||
EncryptedConfiguration( | ||
sa.Text, settings.DATASOURCE_SECRET_KEY, FernetEngine | ||
) | ||
), | ||
), | ||
sa.Column("options", ConfigurationContainer.as_mutable(Configuration)), | ||
) | ||
|
||
conn = op.get_bind() | ||
for dest in conn.execute(notification_destinations.select()): | ||
conn.execute( | ||
notification_destinations.update() | ||
.where(notification_destinations.c.id == dest.id) | ||
.values(encrypted_options=dest.options) | ||
) | ||
|
||
op.drop_column("notification_destinations", "options") | ||
op.alter_column("notification_destinations", "encrypted_options", nullable=False) | ||
|
||
|
||
def downgrade(): | ||
pass |
Oops, something went wrong.