GitHub user dosubot[bot] added a comment to the discussion: apache super set db migration issue
<!-- Answer --> You can't use the 74ad1125881c migration head from your 0.0.0-dev instance directly with Superset 5.0.0 or 6.0.0—this migration was present in early 5.0.0 release candidates but was removed from the final 5.0.0 and all later releases. If you try to run your database at this head with official releases, you'll get Alembic errors because the migration script is missing in those versions ([details](https://github.com/apache/superset/issues/33739), [more](https://github.com/apache/superset/issues/34622)). To recover your data and get onto a stable release: 1. **Back up your metadata database** before making any changes. 2. **Manually downgrade** your database to the last official migration head for 5.0.0 (`d482d51c15ca`): ```bash superset db downgrade d482d51c15ca ``` 3. **Switch to the official 5.0.0 codebase** (make sure your code and DB match). 4. **Run migrations and initialize**: ```bash superset db upgrade superset init ``` 5. If you see errors or the downgrade fails, you may need to use Superset's export/import commands to migrate dashboards, datasets, etc., but you’ll likely need to manually clean up exported files to resolve schema mismatches. **Warning:** Downgrading can be risky—some migrations are not fully reversible and you could lose data. Always test this on a copy of your database first ([reference](https://github.com/apache/superset/issues/34622)). For future upgrades, avoid running production on dev builds, always back up before upgrades, and keep your code and DB migration state in sync. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/bcc76b23-3381-4cb1-9d77-423b101ec344?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/bcc76b23-3381-4cb1-9d77-423b101ec344?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/bcc76b23-3381-4cb1-9d77-423b101ec344?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/bcc76b23-3381-4cb1-9d77-423b101ec344?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/bcc76b23-3381-4cb1-9d77-423b101ec344?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/bcc76b23-3381-4cb1-9d77-423b101ec344?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/bcc76b23-3381-4cb1-9d77-423b101ec344?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=You%20can%27t%20use%20the%2074ad1125881c%20migration%20head%20from%20your%200.0.0-dev%20instance%20directly%20with%20Superset%205.0.0%20or%206.0.0%E2%80%94this%20migration%20was%20present%20in%20early%205.0.0%20release%20candidates%20but%20was%20removed%20from%20the%20final%205.0.0%20and%20all%20later%20releases.%20If%20you%20try%20to%20run%20your%20database%20at%20this%20head%20with%20official%20releases%2C%20you%27ll%20get%20Alembic%20errors%20because%20the%20migration%20script%20is%20missing%20in%20those%20versions%20%28%5Bdetails%5D%28https%3A//github.com/apache/superset/issues/33739%29%2C%20%5Bmore%5D%28https%3A//github.com/apache/superset/issues/34622%29%29.%0A%0ATo%20recover%20your%20data%20and%20get%20onto%20a%20stable%20release%3A%0A%0A1.%20% 2A%2ABack%20up%20your%20metadata%20database%2A%2A%20before%20making%20any%20changes.%0A2.%20%2A%2AManually%20downgrade%2A%2A%20your%20database%20to%20the%20last%20official%20migration%20head%20for%205.0.0%20%28%60d482d51c15ca%60%29%3A%0A%20%20%20%60%60%60bash%0A%20%20%20superset%20db%20downgrade%20d482d51c15ca%0A%20%20%20%60%60%60%0A3.%20%2A%2ASwitch%20to%20the%20official%205.0.0%20codebase%2A%2A%20%28make%20sure%20your%20code%20and%20DB%20match%29.%0A4.%20%2A%2ARun%20migrations%20and%20initialize%2A%2A%3A%0A%20%20%20%60%60%60bash%0A%20%20%20superset%20db%20upgrade%0A%20%20%20superset%20init%0A%20%20%20%60%60%60%0A5.%20If%20you%20see%20errors%20or%20the%20downgrade%20fails%2C%20you%20may%20need%20to%20use%20Superset%27s%20export/import%20commands%20to%20migrate%20dashboards%2C%20datasets%2C%20etc.%2C%20but%20you%E2%80%99ll%20likely%20need%20to%20manually%20clean%20up%20exported%20files%20to%20resolve%20schema%20mismatches.%0A%0A%2A%2AWarning%3A%2A%2A%20Downgrading%20can%20be%20risky %E2%80%94some%20migrations%20are%20not%20fully%20reversible%20and%20you%20could%20lose%20data.%20Always%20test%20this%20on%20a%20copy%20of%20your%20database%20first%20%28%5Breference%5D%28https%3A//github.com/apache/superset/issues/34622%29%29.%0A%0AFor%20future%20upgrades%2C%20avoid%20running%20production%20on%20dev%20builds%2C%20always%20back%20up%20before%20upgrades%2C%20and%20keep%20your%20code%20and%20DB%20migration%20state%20in%20sync.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/37232) GitHub link: https://github.com/apache/superset/discussions/37232#discussioncomment-15538465 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
