This is an automated email from the ASF dual-hosted git repository.

johnbodley pushed a commit to branch john-bodley--upgrade-migration-fcea065655
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 880ed470535bcd1b1dc8c00813fcfe7b4c6298f2
Author: John Bodley <[email protected]>
AuthorDate: Thu May 9 17:06:58 2024 -0700

    chore: Update logic in migration fcea065655
---
 ...14-43_17fcea065655_change_text_to_mediumtext.py |  3 --
 .../versions/2024-05-09_19-19_f7b6750b67e8_.py     | 52 ++++++++++++++++++++++
 2 files changed, 52 insertions(+), 3 deletions(-)

diff --git 
a/superset/migrations/versions/2024-02-14_14-43_17fcea065655_change_text_to_mediumtext.py
 
b/superset/migrations/versions/2024-02-14_14-43_17fcea065655_change_text_to_mediumtext.py
index 3ba126d24e..c6332e9df5 100644
--- 
a/superset/migrations/versions/2024-02-14_14-43_17fcea065655_change_text_to_mediumtext.py
+++ 
b/superset/migrations/versions/2024-02-14_14-43_17fcea065655_change_text_to_mediumtext.py
@@ -37,9 +37,6 @@ TABLE_COLUMNS = [
     "css_templates.css",
     "dashboards.css",
     "keyvalue.value",
-    "query.extra_json",
-    "query.executed_sql",
-    "query.select_sql",
     "report_execution_log.value_row_json",
     "report_recipient.recipient_config_json",
     "report_schedule.sql",
diff --git a/superset/migrations/versions/2024-05-09_19-19_f7b6750b67e8_.py 
b/superset/migrations/versions/2024-05-09_19-19_f7b6750b67e8_.py
new file mode 100644
index 0000000000..19b5247d5b
--- /dev/null
+++ b/superset/migrations/versions/2024-05-09_19-19_f7b6750b67e8_.py
@@ -0,0 +1,52 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""change_mediumtext_to_longtext
+
+Revision ID: f7b6750b67e8
+Revises: 4081be5b6b74
+Create Date: 2024-05-09 19:19:46.630140
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'f7b6750b67e8'
+down_revision = '4081be5b6b74'
+
+from alembic import op   # noqa: E402
+from sqlalchemy.dialects.mysql import LONGTEXT, MEDIUMTEXT  # noqa: E402
+from sqlalchemy.dialects.mysql.base import MySQLDialect  # noqa: E402
+from sqlalchemy.engine.reflection import Inspector  # noqa: E402
+
+
+def upgrade():
+    bind = op.get_bind()
+
+    if isinstance(bind.dialect, MySQLDialect):
+       for column in Inspector.from_engine(bind).get_columns("query"):
+           for name in ["executed_sql", "select_sql"]:
+               if column["name"] == name and isinstance(column["type"], 
MEDIUMTEXT):
+                    with op.batch_alter_table("query") as batch_op:
+                        batch_op.alter_column(
+                            name,
+                            existing_type=MEDIUMTEXT,
+                            type_=LONGTEXT,
+                            existing_nullable=True,
+                        )
+
+
+def downgrade():
+    pass

Reply via email to