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:
Andrej Ocenas
2020-04-20 15:48:38 +02:00
committed by GitHub
co-authored by Arve Knudsen
parent d5f8d976f0
commit e5dd7efdee
34 changed files with 446 additions and 204 deletions
@@ -2,7 +2,6 @@ package migrator
import (
"fmt"
"github.com/mattn/go-sqlite3"
"xorm.io/xorm"
)
@@ -95,6 +94,13 @@ func (db *Sqlite3) isThisError(err error, errcode int) bool {
return false
}
func (db *Sqlite3) ErrorMessage(err error) string {
if driverErr, ok := err.(sqlite3.Error); ok {
return driverErr.Error()
}
return ""
}
func (db *Sqlite3) IsUniqueConstraintViolation(err error) bool {
return db.isThisError(err, int(sqlite3.ErrConstraintUnique))
}