You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[X] latest
[ ] @next
[ ] 0.x.x (or put your version here)
Steps to reproduce or a small repository showing the problem:
I've detected a bug in MigrationExecutor.getPendingMigrations()
It's not filtering properly. In facto, it's not filtering at all, it's just returning allMigrations:
/**
* Returns an array of all pending migrations.
*/
public async getPendingMigrations(): Promise<Migration[]> {
const allMigrations = await this.getAllMigrations();
const executedMigrations = await this.getExecutedMigrations();
return allMigrations.filter(migration =>
executedMigrations.find(
executedMigration =>
executedMigration.name === migration.name
)
);
}
This method should return actually pendingMigrations, I mean, the migrations contained in allMigrations but not in executedMigrations.
Solutions/proposals to solve this bug:
I agree with @captainjapeng: instead of filtering out executedMigrations, thus returning only the pending ones, it's filtering only executedMigrations. Still happening in 0.2.25, and the proposed fix (adding ! before the filter call) is correct.
Issue type:
[ ] question
[X] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[X]
cordova
[X]
mongodb
[X]
mssql
[X]
mysql
/mariadb
[X]
oracle
[X]
postgres
[X]
cockroachdb
[X]
sqlite
[X]
sqljs
[X]
react-native
[X]
expo
TypeORM version:
[X]
latest
[ ]
@next
[ ]
0.x.x
(or put your version here)Steps to reproduce or a small repository showing the problem:
I've detected a bug in MigrationExecutor.getPendingMigrations()
It's not filtering properly. In facto, it's not filtering at all, it's just returning allMigrations:
This method should return actually pendingMigrations, I mean, the migrations contained in allMigrations but not in executedMigrations.
Solutions/proposals to solve this bug:
The text was updated successfully, but these errors were encountered: