Ignore schema when dbtype is not postgres #1593
|
@ -14,6 +14,7 @@ import (
|
||||||
"xorm.io/xorm/schemas"
|
"xorm.io/xorm/schemas"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// URI represents an uri to visit database
|
||||||
type URI struct {
|
type URI struct {
|
||||||
DBType schemas.DBType
|
DBType schemas.DBType
|
||||||
Proto string
|
Proto string
|
||||||
|
@ -29,6 +30,13 @@ type URI struct {
|
||||||
Schema string
|
Schema string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetSchema set schema
|
||||||
|
func (uri URI) SetSchema(schema string) {
|
||||||
|
if uri.DBType == schemas.POSTGRES {
|
||||||
|
uri.Schema = schema
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Dialect represents a kind of database
|
// Dialect represents a kind of database
|
||||||
type Dialect interface {
|
type Dialect interface {
|
||||||
Init(*core.DB, *URI) error
|
Init(*core.DB, *URI) error
|
||||||
|
|
|
@ -1245,7 +1245,7 @@ func (engine *Engine) SetTZDatabase(tz *time.Location) {
|
||||||
|
|
||||||
// SetSchema sets the schema of database
|
// SetSchema sets the schema of database
|
||||||
func (engine *Engine) SetSchema(schema string) {
|
func (engine *Engine) SetSchema(schema string) {
|
||||||
engine.dialect.URI().Schema = schema
|
engine.dialect.URI().SetSchema(schema)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unscoped always disable struct tag "deleted"
|
// Unscoped always disable struct tag "deleted"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user