MCPcopy Create free account
hub / github.com/bytebase/bytebase / migrateSqlEditorConnKeys

Function migrateSqlEditorConnKeys

frontend/src/utils/storage-migrate.ts:150–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

148}
149
150function migrateSqlEditorConnKeys() {
151 // "bb.sql-editor.connection-pane.expanded_{env}.{email}"
152 // → "bb.sql-editor.conn-expanded.{env}.{email}"
153 // "bb.sql-editor.connection-pane.expanded-keys.{name}"
154 // → "bb.sql-editor.conn-expanded-keys.{email}" (name→email can't auto-migrate)
155 const keysToMigrate: [string, string][] = [];
156 for (let i = 0; i < localStorage.length; i++) {
157 const key = localStorage.key(i);
158 if (!key) continue;
159
160 if (key.startsWith("bb.sql-editor.connection-pane.expanded_")) {
161 // Format: bb.sql-editor.connection-pane.expanded_{env}.{email}
162 const suffix = key.slice(
163 "bb.sql-editor.connection-pane.expanded_".length
164 );
165 keysToMigrate.push([key, `bb.sql-editor.conn-expanded.${suffix}`]);
166 }
167 }
168 for (const [oldKey, newKey] of keysToMigrate) {
169 moveKey(oldKey, newKey);
170 }
171}
172
173/**
174 * Run all localStorage key migrations. Idempotent — skips if already done.

Callers 1

migrateStorageKeysFunction · 0.85

Calls 2

moveKeyFunction · 0.85
keyMethod · 0.45

Tested by

no test coverage detected