rusackas opened a new pull request, #38157:
URL: https://github.com/apache/superset/pull/38157

   ### SUMMARY
   
   This PR fixes a database migration issue affecting users who upgraded from 
Superset 3.0.x to 4.0.x+. The `user_favorite_tag` table was not being created 
during the upgrade, causing the tag/favorite feature to fail.
   
   **Root Cause:**
   Migration `e0f6f91c2055` (create_user_favorite_table, dated 2023-07-12) 
depended on `bf646a0c1501` (dated 2023-06-28), whose `down_revision` 
(`a23c6f8b1280`) was dated 2023-07-19. This temporal inconsistency caused 
Alembic to skip these migrations for users who had already applied the 3.0.1 
head migration.
   
   **The Fix:**
   This PR adds a "replay" migration that re-runs the `user_favorite_tag` table 
creation using the idempotent `create_table()` utility. This is safe to run on 
all installations:
   - If the table doesn't exist → it gets created
   - If the table already exists → the migration is skipped with an 
informational log message
   
   This follows the established pattern from 
`b7851ee5522f_replay_317970b4400c.py`.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A - This is a database migration fix with no UI changes.
   
   ### TESTING INSTRUCTIONS
   
   1. **For fresh installs:** Run `superset db upgrade` - should complete 
successfully
   2. **For existing installs with the table:** Run `superset db upgrade` - 
should log "Table user_favorite_tag already exists. Skipping..."
   3. **For affected 3.0.x upgraders:** Run `superset db upgrade` - should 
create the missing table
   
   You can verify the table exists with:
   ```sql
   SELECT * FROM information_schema.tables WHERE table_name = 
'user_favorite_tag';
   ```
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #29836
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [x] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [x] Migration is atomic, supports rollback & is backwards-compatible
     - [x] Confirm DB migration upgrade and downgrade tested
     - [x] Runtime estimates and downtime expectations provided: Instant - only 
runs `CREATE TABLE IF NOT EXISTS` equivalent
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.ai/code)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to