2019-08-21 15:32:25 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package storagenodedb
|
|
|
|
|
2019-09-23 20:36:46 +01:00
|
|
|
import (
|
|
|
|
"database/sql"
|
|
|
|
)
|
|
|
|
|
|
|
|
// migratableDB fulfills the migrate.DB interface and the SQLDB interface
|
2019-09-18 17:17:28 +01:00
|
|
|
type migratableDB struct {
|
2019-09-23 20:36:46 +01:00
|
|
|
*sql.DB
|
2019-08-21 15:32:25 +01:00
|
|
|
}
|
|
|
|
|
2019-09-18 17:17:28 +01:00
|
|
|
// Schema returns schema
|
|
|
|
// These are implemented because the migrate.DB interface requires them.
|
|
|
|
// Maybe in the future we should untangle those.
|
|
|
|
func (db *migratableDB) Schema() string {
|
|
|
|
return ""
|
2019-08-21 15:32:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Rebind rebind parameters
|
|
|
|
// These are implemented because the migrate.DB interface requires them.
|
|
|
|
// Maybe in the future we should untangle those.
|
2019-09-18 17:17:28 +01:00
|
|
|
func (db *migratableDB) Rebind(s string) string {
|
|
|
|
return s
|
|
|
|
}
|
2019-08-21 15:32:25 +01:00
|
|
|
|
2019-09-18 17:17:28 +01:00
|
|
|
// Configure sets the underlining SQLDB connection.
|
2019-09-23 20:36:46 +01:00
|
|
|
func (db *migratableDB) Configure(sqlDB *sql.DB) {
|
|
|
|
db.DB = sqlDB
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetDB returns the raw *sql.DB underlying this migratableDB
|
|
|
|
func (db *migratableDB) GetDB() *sql.DB {
|
|
|
|
return db.DB
|
2019-09-18 17:17:28 +01:00
|
|
|
}
|