Skip to content

Commit

Permalink
chore(db-migration): ensure query_context is MediumText before viz mi…
Browse files Browse the repository at this point in the history
…gration (#20936)
  • Loading branch information
ktmud authored Aug 8, 2022
1 parent bb3871d commit 2c8867e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
Create Date: 2022-06-30 22:04:17.686635
"""
from alembic import op
from sqlalchemy.dialects.mysql.base import MySQLDialect

from superset.migrations.shared.migrate_viz import MigrateTreeMap

# revision identifiers, used by Alembic.
Expand All @@ -29,6 +32,14 @@


def upgrade():
# Ensure `slice.params` and `slice.query_context`` in MySQL is MEDIUMTEXT
# before migration, as the migration will save a duplicate form_data backup
# which may significantly increase the size of these fields.
if isinstance(op.get_bind().dialect, MySQLDialect):
# If the columns are already MEDIUMTEXT, this is a no-op
op.execute("ALTER TABLE slices MODIFY params MEDIUMTEXT")
op.execute("ALTER TABLE slices MODIFY query_context MEDIUMTEXT")

MigrateTreeMap.upgrade()


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@
Create Date: 2022-07-19 15:16:06.091961
"""
from alembic import op
from sqlalchemy.dialects.mysql.base import MySQLDialect

# revision identifiers, used by Alembic.
revision = "a39867932713"
down_revision = "06e1e70058c7"

from alembic import op
from sqlalchemy.dialects.mysql.base import MySQLDialect


def upgrade():
if isinstance(op.get_bind().dialect, MySQLDialect):
Expand Down

0 comments on commit 2c8867e

Please sign in to comment.