refactor: drop db migration patch (#5519)
* refactor: remove database migration patch & test Drop migration code since it's been 6 months since 4.0.2 and we no longer need this. See: https://github.com/coder/code-server/issues/5482#issuecomment-1222608635 * chore: refresh patches
This commit is contained in:
@ -9,11 +9,6 @@ ensures that different browser paths will be unique (for example /workspace1 and
|
||||
The easiest way to test is to open files in the same workspace using both / and
|
||||
/vscode and make sure they are not interacting with each other.
|
||||
|
||||
It should also migrate old databases which can be tested by opening in an old
|
||||
code-server.
|
||||
|
||||
This has e2e tests.
|
||||
|
||||
Index: code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
|
||||
===================================================================
|
||||
--- code-server.orig/lib/vscode/src/vs/workbench/services/storage/browser/storageService.ts
|
||||
@ -39,29 +34,3 @@ Index: code-server/lib/vscode/src/vs/workbench/services/storage/browser/storageS
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +146,25 @@ export class BrowserStorageService exten
|
||||
|
||||
await this.workspaceStorage.init();
|
||||
|
||||
+ const firstWorkspaceOpen = this.workspaceStorage.getBoolean(IS_NEW_KEY);
|
||||
+ if (firstWorkspaceOpen === undefined) {
|
||||
+ // Migrate the old database.
|
||||
+ let db: IIndexedDBStorageDatabase | undefined
|
||||
+ try {
|
||||
+ db = await IndexedDBStorageDatabase.create({ id: this.payload.id }, this.logService)
|
||||
+ const items = await db.getItems()
|
||||
+ for (const [key, value] of items) {
|
||||
+ this.workspaceStorage.set(key, value);
|
||||
+ }
|
||||
+ } catch (error) {
|
||||
+ this.logService.error(`[IndexedDB Storage ${this.payload.id}] migrate error: ${toErrorMessage(error)}`);
|
||||
+ } finally {
|
||||
+ if (db) {
|
||||
+ db.close()
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
this.updateIsNew(this.workspaceStorage);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user