forked from getredash/redash
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge mozilla schema updates with schema from master
- Loading branch information
Allen Short
committed
Mar 26, 2019
1 parent
68f62f3
commit b85a58b
Showing
4 changed files
with
122 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""Upgrade 'data_scanned' column to form used in upstream | ||
Revision ID: 40384fa03dd1 | ||
Revises: 58f810489c47 | ||
Create Date: 2018-01-18 18:44:04.917081 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects.postgresql import JSONB | ||
from sqlalchemy.sql.expression import func, cast | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '40384fa03dd1' | ||
down_revision = 'fbc0849e2674' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
qr = sa.sql.table('query_results', | ||
sa.sql.column('data_scanned', sa.String), | ||
sa.sql.column('data', sa.String)) | ||
op.execute( | ||
qr.update() | ||
.where(qr.c.data_scanned != '') | ||
.where(qr.c.data_scanned != 'error') | ||
.where(qr.c.data_scanned != 'N/A') | ||
.values(data=cast( | ||
func.jsonb_set(cast(qr.c.data, JSONB), | ||
'{metadata}', | ||
cast('{"data_scanned": ' + | ||
qr.c.data_scanned + '}', | ||
JSONB)), | ||
sa.String))) | ||
op.drop_column('query_results', 'data_scanned') | ||
|
||
|
||
def downgrade(): | ||
op.add_column('query_results', sa.Column('data_scanned', sa.String(length=255), nullable=True)) |
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,28 @@ | ||
"""add 'data_scanned' column to query_results | ||
Revision ID: 58f810489c47 | ||
Revises: eb2f788f997e | ||
Create Date: 2017-06-25 21:24:54.942119 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '58f810489c47' | ||
down_revision = 'eb2f788f997e' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('query_results', sa.Column('data_scanned', sa.String(length=255), nullable=True)) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column('query_results', 'data_scanned') | ||
# ### end Alembic commands ### |
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,28 @@ | ||
"""Rename 'image_url' to 'profile_image_url' | ||
a revision was changed after we pulled it from upstream in m12, so it had to | ||
be fixed here. | ||
Revision ID: f9571a5ab4f3 | ||
Revises: 40384fa03dd1 | ||
Create Date: 2018-01-18 18:04:07.943843 | ||
""" | ||
from alembic import op | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'f9571a5ab4f3' | ||
down_revision = '40384fa03dd1' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# Upstream changed the column name in migration revision 7671dca4e604 -- | ||
# see git revision 62e5e3892603502c5f3a6da277c33c73510b8819 | ||
op.alter_column('users', 'image_url', new_column_name='profile_image_url') | ||
|
||
|
||
def downgrade(): | ||
op.alter_column('users', 'profile_image_url', new_column_name='image_url') |
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,26 @@ | ||
""" | ||
Merge upstream fulltext search | ||
This formerly merged the fulltext search changes (6b5be7e0a0ef, 5ec5c84ba61e) | ||
with upstream's 7671dca4e604 - but then those changes moved in the revision | ||
graph to be direct descendants of that upstream revision, so the merge point | ||
has been moved. | ||
Revision ID: fbc0849e2674 | ||
Revises: 6b5be7e0a0ef, eb2f788f997e | ||
Create Date: 2017-12-12 04:45:34.360587 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'fbc0849e2674' | ||
down_revision = ('6b5be7e0a0ef', '58f810489c47') | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
pass | ||
|
||
|
||
def downgrade(): | ||
pass |