Skip to content

Commit

Permalink
fix: added new migration to remove DEIP token
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulhakim2902 committed Jan 25, 2023
1 parent d253c9b commit aef6081
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export class MyriadApiApplication extends BootMixin(
if (options?.existingSchema === 'drop') return this.databaseSeeding();
await Promise.allSettled([
this.doMigrateComment(),
this.doMigrateCurrency(),
this.doMigratePost(),
this.doMigrateUser(),
]);
Expand Down Expand Up @@ -641,6 +642,24 @@ export class MyriadApiApplication extends BootMixin(
bar.stop();
}

async doMigrateCurrency(): Promise<void> {
if (!this.doCollectionExists('currency')) return;

const {currencyRepository, userCurrencyRepository} =
await this.repositories();
const currencies = await currencyRepository.find({
where: {
networkId: 'myriad',
},
});
const currencyIds = currencies.map(currency => currency.id);

await userCurrencyRepository.deleteAll({
currencyId: {nin: currencyIds},
networkId: 'myriad',
});
}

async repositories(): Promise<Repositories> {
const accountSettingRepository = await this.getRepository(
AccountSettingRepository,
Expand Down

0 comments on commit aef6081

Please sign in to comment.