|
|
|
@@ -13,7 +13,7 @@ import (
|
|
|
|
|
const cleanupUpdates = `-- name: CleanupUpdates :exec
|
|
|
|
|
DELETE FROM "Updates"
|
|
|
|
|
WHERE "UpdateType" = ?1 AND "UpdateTime" <= ?2
|
|
|
|
|
RETURNING Uid, InventoryId, UpdateTime, UpdateType, NewVcpus, NewRam, NewResourcePool, EventKey, EventId, NewProvisionedDisk, UserName
|
|
|
|
|
RETURNING Uid, InventoryId, UpdateTime, UpdateType, NewVcpus, NewRam, NewResourcePool, EventKey, EventId, NewProvisionedDisk, UserName, PlaceholderChange
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type CleanupUpdatesParams struct {
|
|
|
|
@@ -210,11 +210,11 @@ func (q *Queries) CreateInventoryHistory(ctx context.Context, arg CreateInventor
|
|
|
|
|
|
|
|
|
|
const createUpdate = `-- name: CreateUpdate :one
|
|
|
|
|
INSERT INTO "Updates" (
|
|
|
|
|
"InventoryId", "EventKey", "EventId", "UpdateTime", "UpdateType", "NewVcpus", "NewRam", "NewResourcePool", "NewProvisionedDisk", "UserName"
|
|
|
|
|
"InventoryId", "EventKey", "EventId", "UpdateTime", "UpdateType", "NewVcpus", "NewRam", "NewResourcePool", "NewProvisionedDisk", "UserName", "PlaceholderChange"
|
|
|
|
|
) VALUES(
|
|
|
|
|
?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
|
|
|
|
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
|
|
|
|
)
|
|
|
|
|
RETURNING Uid, InventoryId, UpdateTime, UpdateType, NewVcpus, NewRam, NewResourcePool, EventKey, EventId, NewProvisionedDisk, UserName
|
|
|
|
|
RETURNING Uid, InventoryId, UpdateTime, UpdateType, NewVcpus, NewRam, NewResourcePool, EventKey, EventId, NewProvisionedDisk, UserName, PlaceholderChange
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type CreateUpdateParams struct {
|
|
|
|
@@ -228,6 +228,7 @@ type CreateUpdateParams struct {
|
|
|
|
|
NewResourcePool sql.NullString
|
|
|
|
|
NewProvisionedDisk sql.NullFloat64
|
|
|
|
|
UserName sql.NullString
|
|
|
|
|
PlaceholderChange sql.NullString
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *Queries) CreateUpdate(ctx context.Context, arg CreateUpdateParams) (Updates, error) {
|
|
|
|
@@ -242,6 +243,7 @@ func (q *Queries) CreateUpdate(ctx context.Context, arg CreateUpdateParams) (Upd
|
|
|
|
|
arg.NewResourcePool,
|
|
|
|
|
arg.NewProvisionedDisk,
|
|
|
|
|
arg.UserName,
|
|
|
|
|
arg.PlaceholderChange,
|
|
|
|
|
)
|
|
|
|
|
var i Updates
|
|
|
|
|
err := row.Scan(
|
|
|
|
@@ -256,6 +258,7 @@ func (q *Queries) CreateUpdate(ctx context.Context, arg CreateUpdateParams) (Upd
|
|
|
|
|
&i.EventId,
|
|
|
|
|
&i.NewProvisionedDisk,
|
|
|
|
|
&i.UserName,
|
|
|
|
|
&i.PlaceholderChange,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -566,7 +569,7 @@ func (q *Queries) GetReportInventory(ctx context.Context) ([]Inventory, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getReportUpdates = `-- name: GetReportUpdates :many
|
|
|
|
|
SELECT Uid, InventoryId, UpdateTime, UpdateType, NewVcpus, NewRam, NewResourcePool, EventKey, EventId, NewProvisionedDisk, UserName FROM "Updates"
|
|
|
|
|
SELECT Uid, InventoryId, UpdateTime, UpdateType, NewVcpus, NewRam, NewResourcePool, EventKey, EventId, NewProvisionedDisk, UserName, PlaceholderChange FROM "Updates"
|
|
|
|
|
ORDER BY "UpdateTime"
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
@@ -591,6 +594,7 @@ func (q *Queries) GetReportUpdates(ctx context.Context) ([]Updates, error) {
|
|
|
|
|
&i.EventId,
|
|
|
|
|
&i.NewProvisionedDisk,
|
|
|
|
|
&i.UserName,
|
|
|
|
|
&i.PlaceholderChange,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|