Add FolderUID for library elements (#79572)
* Add FolderUID in missing places for libraryelements * Add migration for FolderUID in library elements table * Add Folder UIDs tolibrary panels * Adjust dashboard import with folder uid * Fix lint * Rename back FolderUID to UID * Remove default * Check if folderUID is nil * Add unique indes on org_id,folder_uid,name and kind * Update pkg/services/libraryelements/database.go Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com> * Fix folder integration test, with unique index on library elements * Make folder uids nullable and rewrite migration query * Use dashboard uid instead of folder_uid * Adjust test --------- Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
co-authored by
Sofia Papagiannaki
parent
2182cc47ac
commit
2532047e7a
@@ -149,14 +149,20 @@ func (l *LibraryElementService) createLibraryElement(c context.Context, signedIn
|
||||
}
|
||||
|
||||
metrics.MFolderIDsServiceCount.WithLabelValues(metrics.LibraryElements).Inc()
|
||||
// folderUID *string will be changed to string
|
||||
var folderUID string
|
||||
if cmd.FolderUID != nil {
|
||||
folderUID = *cmd.FolderUID
|
||||
}
|
||||
element := model.LibraryElement{
|
||||
OrgID: signedInUser.GetOrgID(),
|
||||
FolderID: cmd.FolderID, // nolint:staticcheck
|
||||
UID: createUID,
|
||||
Name: cmd.Name,
|
||||
Model: updatedModel,
|
||||
Version: 1,
|
||||
Kind: cmd.Kind,
|
||||
OrgID: signedInUser.GetOrgID(),
|
||||
FolderID: cmd.FolderID, // nolint:staticcheck
|
||||
FolderUID: folderUID,
|
||||
UID: createUID,
|
||||
Name: cmd.Name,
|
||||
Model: updatedModel,
|
||||
Version: 1,
|
||||
Kind: cmd.Kind,
|
||||
|
||||
Created: time.Now(),
|
||||
Updated: time.Now(),
|
||||
|
||||
Reference in New Issue
Block a user