You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Copy the backup file over the current database file
149
+
fs.copyFileSync("./backup.db", "./mydata.db");
150
+
151
+
// Reopen the database with the restored data
152
+
const restoredDb =newDatabaseSync("./mydata.db");
153
+
154
+
// Verify restoration
155
+
const count =restoredDb.prepare("SELECT COUNT(*) as count FROM users").get();
156
+
console.log(`Restored database has ${count.count} users`);
157
+
```
158
+
139
159
### Session-based Change Tracking
140
160
141
161
SQLite's session extension allows you to record changes and apply them to other databases - perfect for synchronization, replication, or undo/redo functionality. This feature is available in both `node:sqlite` and `@photostructure/sqlite`, but not in better-sqlite3.
0 commit comments