feat: fix all migrations that were setting undefined values
This commit is contained in:
parent
34f0f7d922
commit
034713256c
|
@ -47,10 +47,12 @@ export class MoveEnvironmentStateToProviders extends Migrator<11, 12> {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Delete legacy global data
|
if (legacyGlobal != null) {
|
||||||
delete legacyGlobal?.region;
|
// Delete legacy global data
|
||||||
delete legacyGlobal?.environmentUrls;
|
delete legacyGlobal?.region;
|
||||||
await helper.set("global", legacyGlobal);
|
delete legacyGlobal?.environmentUrls;
|
||||||
|
await helper.set("global", legacyGlobal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async rollback(helper: MigrationHelper): Promise<void> {
|
async rollback(helper: MigrationHelper): Promise<void> {
|
||||||
|
|
|
@ -143,8 +143,10 @@ export class TokenServiceStateProviderMigrator extends Migrator<37, 38> {
|
||||||
await helper.setToGlobal(EMAIL_TWO_FACTOR_TOKEN_RECORD_DISK_LOCAL, emailTwoFactorTokenRecord);
|
await helper.setToGlobal(EMAIL_TWO_FACTOR_TOKEN_RECORD_DISK_LOCAL, emailTwoFactorTokenRecord);
|
||||||
|
|
||||||
// Delete global data
|
// Delete global data
|
||||||
delete globalData?.twoFactorToken;
|
if (globalData != null) {
|
||||||
await helper.set("global", globalData);
|
delete globalData?.twoFactorToken;
|
||||||
|
await helper.set("global", globalData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async rollback(helper: MigrationHelper): Promise<void> {
|
async rollback(helper: MigrationHelper): Promise<void> {
|
||||||
|
|
|
@ -20,8 +20,10 @@ export class RememberedEmailMigrator extends Migrator<50, 51> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete legacy global data
|
// Delete legacy global data
|
||||||
delete legacyGlobal?.rememberedEmail;
|
if (legacyGlobal != null) {
|
||||||
await helper.set("global", legacyGlobal);
|
delete legacyGlobal?.rememberedEmail;
|
||||||
|
await helper.set("global", legacyGlobal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async rollback(helper: MigrationHelper): Promise<void> {
|
async rollback(helper: MigrationHelper): Promise<void> {
|
||||||
|
|
|
@ -105,7 +105,9 @@ export class KnownAccountsMigrator extends Migrator<59, 60> {
|
||||||
|
|
||||||
private async migrateActiveAccountId(helper: MigrationHelper) {
|
private async migrateActiveAccountId(helper: MigrationHelper) {
|
||||||
const activeAccountId = await helper.get<string>("activeUserId");
|
const activeAccountId = await helper.get<string>("activeUserId");
|
||||||
await helper.setToGlobal(ACCOUNT_ACTIVE_ACCOUNT_ID, activeAccountId);
|
if (activeAccountId != null) {
|
||||||
await helper.remove("activeUserId");
|
await helper.setToGlobal(ACCOUNT_ACTIVE_ACCOUNT_ID, activeAccountId);
|
||||||
|
await helper.remove("activeUserId");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,10 +122,12 @@ export class VaultTimeoutSettingsServiceStateProviderMigrator extends Migrator<6
|
||||||
|
|
||||||
await Promise.all([...accounts.map(({ userId, account }) => migrateAccount(userId, account))]);
|
await Promise.all([...accounts.map(({ userId, account }) => migrateAccount(userId, account))]);
|
||||||
|
|
||||||
// Delete global data (works for browser extension and web; CLI doesn't have these as global settings).
|
if (globalData != null) {
|
||||||
delete globalData?.vaultTimeout;
|
// Delete global data (works for browser extension and web; CLI doesn't have these as global settings).
|
||||||
delete globalData?.vaultTimeoutAction;
|
delete globalData?.vaultTimeout;
|
||||||
await helper.set("global", globalData);
|
delete globalData?.vaultTimeoutAction;
|
||||||
|
await helper.set("global", globalData);
|
||||||
|
}
|
||||||
|
|
||||||
// Remove desktop only settings. These aren't found by the above global key removal b/c of
|
// Remove desktop only settings. These aren't found by the above global key removal b/c of
|
||||||
// the different storage key format. This removal does not cause any issues on migrating for other clients.
|
// the different storage key format. This removal does not cause any issues on migrating for other clients.
|
||||||
|
|
Loading…
Reference in New Issue