()
| 148 | } |
| 149 | |
| 150 | function 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. |
no test coverage detected