mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +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)
|
||||
await db(TableName.Snapshot)
|
||||
// eslint-disable-next-line func-names
|
||||
.whereNotIn("folderId", function () {
|
||||
void this.select("folderId").from(TableName.SecretFolderVersion);
|
||||
})
|
||||
// eslint-disable-next-line func-names
|
||||
.whereNotIn("folderId", function () {
|
||||
void this.select("folderId").from(TableName.SecretFolder);
|
||||
void this.select("folderId")
|
||||
.from(TableName.SecretFolderVersion)
|
||||
.union(function () {
|
||||
void this.select("id").from(TableName.SecretFolder);
|
||||
});
|
||||
})
|
||||
.delete();
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user