|
|
|
@@ -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, PlaceholderChange
|
|
|
|
|
RETURNING Uid, InventoryId, UpdateTime, UpdateType, NewVcpus, NewRam, NewResourcePool, EventKey, EventId, NewProvisionedDisk, UserName, PlaceholderChange, Name
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type CleanupUpdatesParams struct {
|
|
|
|
@@ -210,15 +210,16 @@ 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", "PlaceholderChange"
|
|
|
|
|
"InventoryId", "Name", "EventKey", "EventId", "UpdateTime", "UpdateType", "NewVcpus", "NewRam", "NewResourcePool", "NewProvisionedDisk", "UserName", "PlaceholderChange"
|
|
|
|
|
) VALUES(
|
|
|
|
|
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
|
|
|
|
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
|
|
|
|
)
|
|
|
|
|
RETURNING Uid, InventoryId, UpdateTime, UpdateType, NewVcpus, NewRam, NewResourcePool, EventKey, EventId, NewProvisionedDisk, UserName, PlaceholderChange
|
|
|
|
|
RETURNING Uid, InventoryId, UpdateTime, UpdateType, NewVcpus, NewRam, NewResourcePool, EventKey, EventId, NewProvisionedDisk, UserName, PlaceholderChange, Name
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
type CreateUpdateParams struct {
|
|
|
|
|
InventoryId sql.NullInt64
|
|
|
|
|
Name sql.NullString
|
|
|
|
|
EventKey sql.NullString
|
|
|
|
|
EventId sql.NullString
|
|
|
|
|
UpdateTime sql.NullInt64
|
|
|
|
@@ -234,6 +235,7 @@ type CreateUpdateParams struct {
|
|
|
|
|
func (q *Queries) CreateUpdate(ctx context.Context, arg CreateUpdateParams) (Updates, error) {
|
|
|
|
|
row := q.db.QueryRowContext(ctx, createUpdate,
|
|
|
|
|
arg.InventoryId,
|
|
|
|
|
arg.Name,
|
|
|
|
|
arg.EventKey,
|
|
|
|
|
arg.EventId,
|
|
|
|
|
arg.UpdateTime,
|
|
|
|
@@ -259,6 +261,7 @@ func (q *Queries) CreateUpdate(ctx context.Context, arg CreateUpdateParams) (Upd
|
|
|
|
|
&i.NewProvisionedDisk,
|
|
|
|
|
&i.UserName,
|
|
|
|
|
&i.PlaceholderChange,
|
|
|
|
|
&i.Name,
|
|
|
|
|
)
|
|
|
|
|
return i, err
|
|
|
|
|
}
|
|
|
|
@@ -569,7 +572,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, PlaceholderChange FROM "Updates"
|
|
|
|
|
SELECT Uid, InventoryId, UpdateTime, UpdateType, NewVcpus, NewRam, NewResourcePool, EventKey, EventId, NewProvisionedDisk, UserName, PlaceholderChange, Name FROM "Updates"
|
|
|
|
|
ORDER BY "UpdateTime"
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
@@ -595,6 +598,7 @@ func (q *Queries) GetReportUpdates(ctx context.Context) ([]Updates, error) {
|
|
|
|
|
&i.NewProvisionedDisk,
|
|
|
|
|
&i.UserName,
|
|
|
|
|
&i.PlaceholderChange,
|
|
|
|
|
&i.Name,
|
|
|
|
|
); err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|