backstage / backstage/backstage
Backstage Upgrade - Migration Directory Corrupt error
- Dominant language
- TypeScript
- Stars
- 34.4k
- Forks
- 7.6k
- Avg merge
- 8h 57m
- Merged PRs (30d)
- 50
Description
### 📜 Issue Labels
- [x] Please familiarize yourself with the issue labels used in this project: [LABELS.md](https://github.com/backstage/backstage/blob/master/LABELS.md)
### 🔎 Search Terms
```plain
Related to migration directory corrupt error
```
### 🗃️ Project Area
Unknown
### 🔗 External Integration
N/A
### 📝 Description & Context
We understand that Backstage upgrades often involve changes to the migration directory in plugins. As part of the Backstage 1.39 upgrade, it appears there was a modification to the file **20250411000000_last_run.js**.
The issue arises when rolling back a Backstage upgrade to a previous version (e.g., from 1.39 to 1.38) after deploying the changes to an environment (DEV or PROD). During the rollback, deployments fail with the error:
"**The migration directory is corrupt, the following files are missing: 20250411000000_last_run.js**".
While in local development this issue can be resolved by deleting and recreating the database, this approach is not feasible in production environments as it would result in the loss of all stored data.
We are seeking a solution or fix to address this problem, as it would be greatly appreciated. If there is a way to handle migration rollbacks without corrupting the migration directory or losing data, it would help ensure smoother rollbacks in production environments.
### 👍 Expected Behavior
****
### 📦 Reproduction Repo
_No response_
### 🥾 Reproduction steps
_No response_
### Have you read the Code of Conduct?
- [x] I have read the [Code of Conduct](https://github.com/backstage/backstage/blob/master/CODE_OF_CONDUCT.md)
### Are you willing to submit PR?
Undecided
Contributor guide
Research direction
Start by inspecting the migration file 20250411000000_last_run.js and the migration handling involved in the Backstage 1.39 to 1.38 rollback. Reproduce the missing-file failure if possible using the described deployment sequence, then define a rollback path that preserves production data and avoids a corrupt migration directory error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100