mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 13:28:27 +00:00
misc: optimized prune orphan snapshots
This commit is contained in:
@@ -434,13 +434,12 @@ export const snapshotDALFactory = (db: TDbClient) => {
|
|||||||
|
|
||||||
// cleanup orphaned snapshots (those that don't belong to an existing folder and folder version)
|
// cleanup orphaned snapshots (those that don't belong to an existing folder and folder version)
|
||||||
await db(TableName.Snapshot)
|
await db(TableName.Snapshot)
|
||||||
// eslint-disable-next-line func-names
|
|
||||||
.whereNotIn("folderId", function () {
|
.whereNotIn("folderId", function () {
|
||||||
void this.select("folderId").from(TableName.SecretFolderVersion);
|
void this.select("folderId")
|
||||||
})
|
.from(TableName.SecretFolderVersion)
|
||||||
// eslint-disable-next-line func-names
|
.union(function () {
|
||||||
.whereNotIn("folderId", function () {
|
void this.select("id").from(TableName.SecretFolder);
|
||||||
void this.select("folderId").from(TableName.SecretFolder);
|
});
|
||||||
})
|
})
|
||||||
.delete();
|
.delete();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user