fix: Makes created and updated by nullable strings for library panel migration (#108122)
Signed-off-by: Bruno Abrantes <bruno@brunoabrantes.com>
This commit is contained in:
@@ -489,10 +489,10 @@ type panel struct {
|
||||
FolderUID sql.NullString
|
||||
|
||||
Created time.Time
|
||||
CreatedBy string
|
||||
CreatedBy sql.NullString
|
||||
|
||||
Updated time.Time
|
||||
UpdatedBy string
|
||||
UpdatedBy sql.NullString
|
||||
|
||||
Version int64
|
||||
|
||||
@@ -633,13 +633,13 @@ func parseLibraryPanelRow(p panel) (dashboardV0.LibraryPanel, error) {
|
||||
if p.FolderUID.Valid {
|
||||
meta.SetFolder(p.FolderUID.String)
|
||||
}
|
||||
meta.SetCreatedBy(p.CreatedBy)
|
||||
meta.SetCreatedBy(getUserID(p.CreatedBy, sql.NullInt64{}))
|
||||
meta.SetGeneration(p.Version)
|
||||
meta.SetDeprecatedInternalID(p.ID) //nolint:staticcheck
|
||||
|
||||
// Only set updated metadata if it is different
|
||||
if p.UpdatedBy != p.CreatedBy || p.Updated.Sub(p.Created) > time.Second {
|
||||
meta.SetUpdatedBy(p.UpdatedBy)
|
||||
if p.UpdatedBy.Valid && p.Updated.Sub(p.Created) > time.Second {
|
||||
meta.SetUpdatedBy(getUserID(p.UpdatedBy, sql.NullInt64{}))
|
||||
meta.SetUpdatedTimestamp(&p.Updated)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user