mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Database: Initialize xorm with an empty schema for postgres (#17357)
xorm introduced some changes in https://github.com/go-xorm/xorm/pull/824 and https://github.com/go-xorm/xorm/pull/876 which by default will use public as the postgres schema and this was a breaking change compared to before. Grafana has implemented a custom postgres dialect so above changes wasn't a problem here. However, Grafana's custom database migration was using xorm dialect to check if the migration table exists or not. For those using a custom search_path (schema) in postgres configured on server, database or user level the migration table check would not find the migration table since it was looking in public schema due to xorm changes above. This had the consequence that Grafana's database migration failed the second time since migration had already run migrations in another schema. This change will make xorm use an empty default schema for postgres and by that mimic the functionality of how it was functioning before xorm's changes above. Fixes #16720 Co-Authored-By: Carl Bergquist <carl@grafana.com>
This commit is contained in:
committed by
GitHub
parent
fbf37eb402
commit
b7a9533476
@@ -37,6 +37,11 @@ var (
|
||||
const ContextSessionName = "db-session"
|
||||
|
||||
func init() {
|
||||
// This change will make xorm use an empty default schema for postgres and
|
||||
// by that mimic the functionality of how it was functioning before
|
||||
// xorm's changes above.
|
||||
xorm.DefaultPostgresSchema = ""
|
||||
|
||||
registry.Register(®istry.Descriptor{
|
||||
Name: "SqlStore",
|
||||
Instance: &SqlStore{},
|
||||
|
||||
Reference in New Issue
Block a user