superset
superset copied to clipboard
fix(migrations): Fix the time comparison migration
SUMMARY
After the initial version of the time comparison feature for Table and Big Number we introduced a migration to upgrade old charts to the new comparison controls, however, during that upgrade a table that never had comparison in it was wrongly showing Time Comparison Data.
This PR is fixing the migration so we can properly upgrade such old tables if needed, also we extend our tests to not only consider charts that have the enabled_time_comparison flag set to True.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE
Old version of Chart using Time Comparison once but then removing it from the controls:
The old Chart is upgraded with the previous version of the migration:
The chart start showing comparison data:
AFTER
Old version of Chart using Time Comparison once but then removing it from the controls:
The old Chart is upgraded with the new version of the migration:
The chart doesn't show comparison data:
TESTING INSTRUCTIONS
- Create a table chart with a version of the time comparison where Enable Time Comparison checkbox was used
- Run a comparison data (Mark the checkbox and select a time range)
- Unmark the checkbox and run the chart data again so your chart has no longer comparison info
- Use more updated version and run the migrations so your table is upgraded
- You must not see time comparison data in the table.
ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [X] Includes DB Migration (follow approval process in SIP-59)
- [X] Migration is atomic, supports rollback & is backwards-compatible
- [X] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API