Files
duplicati/Duplicati/Library/Main/Database/Local/Database schema/5. Optimize BlockSet-Tables.sql
T
Kenneth Skovhede 62ea2d23f5 Added a sync command to the Controller and CLI.
This refactors a part of the database and adds a new "sync" command that reuses a lot of the backup logic to take a set of sources and apply them to a backend.

Unlike the backup process, the sync copies files verbatim without any encryption.
2026-06-25 15:49:00 +02:00

30 lines
996 B
SQL

DROP INDEX "BlocksetEntryIds_Forward";
DROP INDEX "BlocksetEntryIds_Backwards";
ALTER TABLE "BlocksetEntry"
RENAME TO "UPGRADE_BlocksetEntry";
-- ["WITHOUT ROWID" works with SQLite v3.8.2 (eq System.Data.SQLite v1.0.90.0, rel 2013-12-23) and later]
CREATE TABLE "BlocksetEntry" (
"BlocksetID" INTEGER NOT NULL,
"Index" INTEGER NOT NULL,
"BlockID" INTEGER NOT NULL,
CONSTRAINT "BlocksetEntry_PK_IdIndex" PRIMARY KEY ("BlocksetID", "Index")
) {#if sqlite_version >= 3.8.2} WITHOUT ROWID {#endif};
INSERT INTO "BlocksetEntry" ("BlocksetID", "Index", "BlockID")
SELECT "BlocksetID", "Index", "BlockID"
FROM "UPGRADE_BlocksetEntry";
DROP TABLE "UPGRADE_BlocksetEntry";
/* As this table is a cross table we need fast lookup */
CREATE INDEX "BlocksetEntry_IndexIdsBackwards" ON "BlocksetEntry" ("BlockID");
/* Add index for faster volume based block access (for compacting) */
CREATE INDEX "Block_IndexByVolumeId" ON "Block" ("VolumeID");
UPDATE "Version" SET "Version" = 5;