cleanup templates
This commit is contained in:
@@ -58,6 +58,11 @@ DELETE FROM "Inventory"
|
||||
WHERE "Vcenter" = sqlc.arg('vc')
|
||||
RETURNING *;
|
||||
|
||||
-- name: InventoryCleanupTemplates :exec
|
||||
DELETE FROM "Inventory"
|
||||
WHERE "IsTemplate" = "TRUE"
|
||||
RETURNING *;
|
||||
|
||||
-- name: CreateUpdate :one
|
||||
INSERT INTO "Updates" (
|
||||
"InventoryId", "Name", "EventKey", "EventId", "UpdateTime", "UpdateType", "NewVcpus", "NewRam", "NewResourcePool", "NewProvisionedDisk", "UserName", "PlaceholderChange", "RawChangeString"
|
||||
|
@@ -644,6 +644,17 @@ func (q *Queries) InventoryCleanup(ctx context.Context, arg InventoryCleanupPara
|
||||
return err
|
||||
}
|
||||
|
||||
const inventoryCleanupTemplates = `-- name: InventoryCleanupTemplates :exec
|
||||
DELETE FROM "Inventory"
|
||||
WHERE "IsTemplate" = "TRUE"
|
||||
RETURNING Iid, Name, Vcenter, VmId, EventKey, CloudId, CreationTime, DeletionTime, ResourcePool, VmType, Datacenter, Cluster, Folder, ProvisionedDisk, InitialVcpus, InitialRam, IsTemplate, PoweredOn, SrmPlaceholder, VmUuid
|
||||
`
|
||||
|
||||
func (q *Queries) InventoryCleanupTemplates(ctx context.Context) error {
|
||||
_, err := q.db.ExecContext(ctx, inventoryCleanupTemplates)
|
||||
return err
|
||||
}
|
||||
|
||||
const inventoryCleanupVcenter = `-- name: InventoryCleanupVcenter :exec
|
||||
DELETE FROM "Inventory"
|
||||
WHERE "Vcenter" = ?1
|
||||
|
@@ -26,7 +26,7 @@ func (h *Handler) UpdateCleanup(w http.ResponseWriter, r *http.Request) {
|
||||
err := h.Database.Queries().CleanupUpdates(context.Background(), params)
|
||||
*/
|
||||
|
||||
err := h.Database.Queries().CleanupUpdatesNullVm(context.Background())
|
||||
err := h.Database.Queries().InventoryCleanupTemplates(context.Background())
|
||||
|
||||
if err != nil {
|
||||
h.Logger.Error("Error received cleaning updates table", "error", err)
|
||||
|
Reference in New Issue
Block a user