You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2026/04/22 18:53:25 UTC
Re: [PR] fix(migrations): replay user_favorite_tag migration for 3.0.x upgraders [superset]
rusackas commented on code in PR #38157:
URL: https://github.com/apache/superset/pull/38157#discussion_r3126238073
##########
superset/migrations/versions/2026-02-21_22-00_a1b2c3d4e5f6_replay_user_favorite_tag_migration.py:
##########
@@ -0,0 +1,74 @@
+# 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.
+"""replay user_favorite_tag migration for users upgrading from 3.0.x
+
+This migration replays the user_favorite_tag table creation for users who
+upgraded from Superset 3.0.x and missed migration e0f6f91c2055 due to
+out-of-order migration timestamps.
+
+See: https://github.com/apache/superset/issues/29836
+
+The original migration (e0f6f91c2055) was dated 2023-07-12 but depended on
+bf646a0c1501 which was dated 2023-06-28. However, bf646a0c1501's down_revision
+(a23c6f8b1280) was dated 2023-07-19, creating a temporal inconsistency that
+caused Alembic to skip these migrations for users upgrading through the 3.0.x
+release line.
+
+This replay migration safely re-runs the table creation using idempotent
+utilities, ensuring the user_favorite_tag table exists regardless of the
+upgrade path taken.
+
+Revision ID: a1b2c3d4e5f6
+Revises: 4b2a8c9d3e1f
+Create Date: 2026-02-21 22:00:00.000000
+
+"""
+
+from importlib import import_module
+
+# revision identifiers, used by Alembic.
+revision = "a1b2c3d4e5f6"
+down_revision = "4b2a8c9d3e1f"
+
+# Import the original migration module
+module = import_module(
+ "superset.migrations.versions.2023-07-12_20-34_e0f6f91c2055_create_user_favorite_table"
+)
+
+
+def upgrade():
+ """
+ Replay the user_favorite_tag table creation.
+
+ This uses the idempotent create_table() utility from the original migration,
+ which safely skips creation if the table already exists.
+ """
+ module.upgrade()
Review Comment:
Good question — I checked and `user_favorite_tag` is only touched by the original create migration (`e0f6f91c2055`); no subsequent migrations alter it. `grep -r user_favorite_tag superset/migrations/versions/` returns only that file and this replay. The current `superset/tags/models.py` schema (user_id + tag_id with FKs to `ab_user.id` and `tag.id`) matches the original create exactly, so replaying `e0f6f91c2055` alone is sufficient to get affected 3.0.x upgraders to the current state.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org