-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Closed
Labels
Description
Issue Description
When running typeorm migration:revert --fake the fake flag isn't passed in the options to runMigrations
Expected Behavior
The migration's down method won't be executed, but the migration record will be removed from the executed migrations table.
Actual Behavior
The down method is executed.
Steps to Reproduce
- Create empty migration and add it to your data-source:
typeorm migration:create testFakeFlag - In the
downmethod add a console printconsole.log("It's going down!") - Run migration:
typeorm migration:run -d src/data-source.ts - Fake revert migration:
typeorm migration:revert -d src/data-source.ts
My Environment
node 18.12
typescript 4.9.3
typeorm 0.3.10
using a mongo data source.
mongodb (node.js package) 4.12
mongodb (server) 6.0.2
Additional Context
This is clear from PR #8976 which introduced this feature. Just missing this line from MigrationRevertCommand.ts
const options = {
...
fake: !!args.f,
}and an appropriate test.
Relevant Database Driver(s)
technically only tested on mongo -- but the issue is quite clearly not db dependent.
| DB Type | Reproducible |
|---|---|
aurora-mysql |
no |
aurora-postgres |
no |
better-sqlite3 |
no |
cockroachdb |
no |
cordova |
no |
expo |
no |
mongodb |
yes |
mysql |
no |
nativescript |
no |
oracle |
no |
postgres |
no |
react-native |
no |
sap |
no |
spanner |
no |
sqlite |
no |
sqlite-abstract |
no |
sqljs |
no |
sqlserver |
no |
Are you willing to resolve this issue by submitting a Pull Request?
- ✅ Yes, I have the time, and I know how to start.