mirror of
https://github.com/grafana/grafana.git
synced 2025-09-24 12:33:59 +08:00
Provisioning: Allows specifying uid for datasource and use that in derived fields (#23585)
* Add uid to datasource * Fix uid passing when provisioning * Better error handling and Uid column type change * Fix test and strict null error counts * Add backend tests * Add tests * Fix strict null checks * Update test * Improve tests * Update pkg/services/sqlstore/datasource.go Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com> * Variable rename Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@ -2,11 +2,11 @@ package migrator
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/lib/pq"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana/pkg/util/errutil"
|
||||
"github.com/lib/pq"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
@ -149,6 +149,13 @@ func (db *Postgres) isThisError(err error, errcode string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (db *Postgres) ErrorMessage(err error) string {
|
||||
if driverErr, ok := err.(*pq.Error); ok {
|
||||
return driverErr.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (db *Postgres) IsUniqueConstraintViolation(err error) bool {
|
||||
return db.isThisError(err, "23505")
|
||||
}
|
||||
|
Reference in New Issue
Block a user