2019-09-20 17:26:07 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package migrate
|
|
|
|
|
|
|
|
import (
|
2021-04-23 10:52:40 +01:00
|
|
|
"storj.io/private/tagsql"
|
2019-09-20 17:26:07 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// DBX contains additional methods for migrations.
|
|
|
|
type DBX interface {
|
2020-01-30 19:38:25 +00:00
|
|
|
tagsql.DB
|
2019-09-20 17:26:07 +01:00
|
|
|
Schema() string
|
|
|
|
Rebind(string) string
|
|
|
|
}
|
|
|
|
|
|
|
|
// rebind uses Rebind method when the database has the func.
|
2020-01-30 19:38:25 +00:00
|
|
|
func rebind(db tagsql.DB, s string) string {
|
2020-01-15 07:25:26 +00:00
|
|
|
if dbx, ok := db.(interface{ Rebind(string) string }); ok {
|
2019-09-20 17:26:07 +01:00
|
|
|
return dbx.Rebind(s)
|
|
|
|
}
|
|
|
|
return s
|
|
|
|
}
|