Add PostgreSQL checkpoint functionality and update related database operations
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-02-16 09:21:00 +11:00
parent ff1ec3f4aa
commit 6da2da3e82
8 changed files with 412 additions and 34 deletions

View File

@@ -928,7 +928,9 @@ func addSummaryPivotSheet(logger *slog.Logger, xlsx *excelize.File, dataSheet st
logger.Warn("summary worksheet skipped due to invalid data range", "table", tableName, "error", err)
return
}
dataRange := fmt.Sprintf("%s!A1:%s", quoteSheetName(dataSheet), endCell)
// excelize AddPivotTable expects unquoted sheet references like:
// "Snapshot Report!A1:Z999". Quoted sheet names cause pivot creation to fail.
dataRange := fmt.Sprintf("%s!A1:%s", dataSheet, endCell)
lowerToHeader := make(map[string]string, len(headers))
for _, header := range headers {
lowerToHeader[strings.ToLower(strings.TrimSpace(header))] = header
@@ -943,7 +945,7 @@ func addSummaryPivotSheet(logger *slog.Logger, xlsx *excelize.File, dataSheet st
Title: "Sum of Avg vCPUs",
TitleCell: "A1",
PivotName: "PivotAvgVcpu",
PivotRange: fmt.Sprintf("%s!A3:H1000", quoteSheetName(summarySheet)),
PivotRange: fmt.Sprintf("%s!A3:H22", summarySheet),
RowFields: []string{"Datacenter", "ResourcePool"},
DataField: "AvgVcpuCount",
DataName: "Sum of Avg vCPUs",
@@ -953,7 +955,7 @@ func addSummaryPivotSheet(logger *slog.Logger, xlsx *excelize.File, dataSheet st
Title: "Sum of Avg RAM",
TitleCell: "J1",
PivotName: "PivotAvgRam",
PivotRange: fmt.Sprintf("%s!J3:P1000", quoteSheetName(summarySheet)),
PivotRange: fmt.Sprintf("%s!J3:P22", summarySheet),
RowFields: []string{"Datacenter"},
DataField: "AvgRamGB",
DataName: "Sum of Avg RAM",
@@ -961,9 +963,9 @@ func addSummaryPivotSheet(logger *slog.Logger, xlsx *excelize.File, dataSheet st
},
{
Title: "Sum of prorated VM count",
TitleCell: "A1003",
TitleCell: "A23",
PivotName: "PivotProratedVmCount",
PivotRange: fmt.Sprintf("%s!A1005:H2002", quoteSheetName(summarySheet)),
PivotRange: fmt.Sprintf("%s!A25:H44", summarySheet),
RowFields: []string{"Datacenter"},
DataField: "AvgIsPresent",
DataName: "Sum of prorated VM count",
@@ -971,9 +973,9 @@ func addSummaryPivotSheet(logger *slog.Logger, xlsx *excelize.File, dataSheet st
},
{
Title: "Count of VM Name",
TitleCell: "J1003",
TitleCell: "J23",
PivotName: "PivotVmNameCount",
PivotRange: fmt.Sprintf("%s!J1005:P2002", quoteSheetName(summarySheet)),
PivotRange: fmt.Sprintf("%s!J25:P44", summarySheet),
RowFields: []string{"Datacenter"},
DataField: "Name",
DataName: "Count of VM Name",