1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-18 08:26:45 +02:00
woodpecker/pkg/database/database.go

25 lines
441 B
Go
Raw Normal View History

2014-02-07 13:10:01 +03:00
package database
import (
"database/sql"
"log"
"github.com/drone/drone/pkg/database/schema"
)
// global instance of our database connection.
var db *sql.DB
// Set sets the default database.
func Set(database *sql.DB) {
// set the global database
db = database
// load the database schema. If this is
// a new database all the tables and
// indexes will be created.
if err := schema.Load(db); err != nil {
log.Fatal(err)
}
}