mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-22 04:06:54 +00:00
initial public commit
This commit is contained in:
24
pkg/database/database.go
Normal file
24
pkg/database/database.go
Normal file
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user