Line data Source code
1 : import type { SessionMigrationStep } from '../session_migration.js';
2 :
3 : /// Connections decide whether query results are cached, sessions have no settings.
4 : ///
5 : /// Version 8 kept `settings.cacheQueryResults` in the session file, its only setting. The connections of the app
6 : /// manifest hold the setting now, the step removes the settings of the session.
7 : export const dropSessionSettings: SessionMigrationStep = {
8 1 : version: 9,
9 1 : description: 'Remove the settings of the session, connections decide whether query results are cached',
10 1 : async migrate(folder) {
11 1 : const text = await folder.readText('dashql-session.json');
12 1 : if (text == null) return;
13 1 : const data = JSON.parse(text) as Record<string, unknown>;
14 1 : if (!('settings' in data)) return;
15 1 : delete data.settings;
16 1 : await folder.writeText('dashql-session.json', JSON.stringify(data, null, 2));
17 1 : },
18 : };
|