allow clearing sync mappings
This commit is contained in:
parent
d7d1c47e2a
commit
b7a0376a0f
@ -276,6 +276,11 @@ export const getSyncMetaMappingByRemoteKeyS3 = async (
|
||||
throw Error("something bad in sync meta mapping!");
|
||||
};
|
||||
|
||||
export const clearAllSyncMetaMapping = async (db: lf.DatabaseConnection) => {
|
||||
const tbl = db.getSchema().table(DEFAULT_TBL_SYNC_MAPPING);
|
||||
await db.delete().from(tbl).exec();
|
||||
};
|
||||
|
||||
export const insertSyncPlanRecord = async (
|
||||
db: lf.DatabaseConnection,
|
||||
syncPlan: SyncPlanType
|
||||
|
||||
26
src/main.ts
26
src/main.ts
@ -11,7 +11,11 @@ import {
|
||||
TFolder,
|
||||
} from "obsidian";
|
||||
import * as CodeMirror from "codemirror";
|
||||
import { clearAllSyncPlanRecords, DatabaseConnection } from "./localdb";
|
||||
import {
|
||||
clearAllSyncPlanRecords,
|
||||
clearAllSyncMetaMapping,
|
||||
DatabaseConnection,
|
||||
} from "./localdb";
|
||||
import {
|
||||
prepareDBs,
|
||||
destroyDBs,
|
||||
@ -318,5 +322,25 @@ class SaveRemoteSettingTab extends PluginSettingTab {
|
||||
new Notice("sync plans history (in db) deleted");
|
||||
});
|
||||
});
|
||||
|
||||
const syncMappingDiv = containerEl.createEl("div");
|
||||
syncMappingDiv.createEl("p", {
|
||||
text: "Sync mappings history stores the actual LOCAL last modified time of the REMOTE objects.",
|
||||
});
|
||||
|
||||
syncMappingDiv.createEl("p", {
|
||||
text: "If the sync mappings history are deleted, unnecessary data exchanges may occur in next-time syncing, because whether a remote object and local object with same name are equivalent or not could not be determined correctly by comparing last modified times.",
|
||||
});
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("delete sync mappings history in db")
|
||||
.setDesc("delete sync mappings history in db")
|
||||
.addButton(async (button) => {
|
||||
button.setButtonText("Delete Sync Mappings");
|
||||
button.onClick(async () => {
|
||||
await clearAllSyncMetaMapping(this.plugin.db);
|
||||
new Notice("sync mappings history (in local db) deleted");
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user