-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmigrate_test_db.js
More file actions
32 lines (24 loc) · 1012 Bytes
/
migrate_test_db.js
File metadata and controls
32 lines (24 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Script to test importing the old noteraity.db as a new space
// Run this in the browser console when the app is running
async function importOldDatabase() {
const oldDbPath = "/var/folders/n7/shsj_t096d50t8dx465nkh3h0000gn/T/noteraity.db";
const spaceName = "Imported Notes";
try {
const result = await window.__TAURI__.invoke('import_database_as_space', {
dbPath: oldDbPath,
spaceName: spaceName
});
console.log("Successfully imported database as new space:", result);
// Now switch to the new space
await window.__TAURI__.invoke('switch_space_database', {
spaceId: result.id
});
console.log("Switched to imported space. Refreshing UI...");
// Refresh the app to load the new space
window.location.reload();
} catch (error) {
console.error("Failed to import database:", error);
}
}
// Run the import
importOldDatabase();