diff --git a/packages/indy-sdk-to-askar-migration/src/IndySdkToAskarMigrationUpdater.ts b/packages/indy-sdk-to-askar-migration/src/IndySdkToAskarMigrationUpdater.ts index 73db32bdce..9460e479ee 100644 --- a/packages/indy-sdk-to-askar-migration/src/IndySdkToAskarMigrationUpdater.ts +++ b/packages/indy-sdk-to-askar-migration/src/IndySdkToAskarMigrationUpdater.ts @@ -30,32 +30,22 @@ export class IndySdkToAskarMigrationUpdater { private agent: Agent private dbPath: string private fs: FileSystem - private deleteOnFinish: boolean - private constructor( - walletConfig: WalletConfig, - agent: Agent, - dbPath: string, - deleteOnFinish = false, - defaultLinkSecretId?: string - ) { + private constructor(walletConfig: WalletConfig, agent: Agent, dbPath: string, defaultLinkSecretId?: string) { this.walletConfig = walletConfig this.dbPath = dbPath this.agent = agent this.fs = this.agent.dependencyManager.resolve(InjectionSymbols.FileSystem) this.defaultLinkSecretId = defaultLinkSecretId ?? walletConfig.id - this.deleteOnFinish = deleteOnFinish } public static async initialize({ dbPath, agent, - deleteOnFinish, defaultLinkSecretId, }: { dbPath: string agent: Agent - deleteOnFinish?: boolean defaultLinkSecretId?: string }) { const { @@ -83,7 +73,7 @@ export class IndySdkToAskarMigrationUpdater { throw new IndySdkToAskarMigrationError("Wallet on the agent must be of instance 'AskarWallet'") } - return new IndySdkToAskarMigrationUpdater(walletConfig, agent, dbPath, deleteOnFinish, defaultLinkSecretId) + return new IndySdkToAskarMigrationUpdater(walletConfig, agent, dbPath, defaultLinkSecretId) } /** @@ -186,14 +176,16 @@ export class IndySdkToAskarMigrationUpdater { // Copy the file from the database path to the new location await this.fs.copyFile(src, dest) - - // Delete the original, only if specified by the user - if (this.deleteOnFinish) await this.fs.delete(this.dbPath) } /** * Function that updates the values from an indy-sdk structure to the new askar structure. * + * > NOTE: It is very important that this script is ran before the 0.3.x to + * 0.4.x migration script. This can easily be done by calling this when you + * upgrade, before you initialize the agent with `autoUpdateStorageOnStartup: + * true`. + * * - Assert that the paths that will be used are free * - Create a backup of the database * - Migrate the database to askar structure