mirror of
https://github.com/apache/superset.git
synced 2026-06-04 07:09:22 +00:00
chore(db-migration): ensure query_context is MediumText before viz migration (#20936)
This commit is contained in:
@@ -21,6 +21,9 @@ Revises: cdcf3d64daf4
|
||||
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.
|
||||
@@ -29,6 +32,14 @@ down_revision = "cdcf3d64daf4"
|
||||
|
||||
|
||||
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()
|
||||
|
||||
|
||||
|
||||
@@ -21,14 +21,13 @@ Revises: 06e1e70058c7
|
||||
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):
|
||||
|
||||
Reference in New Issue
Block a user