29 lines
454 B
Go
29 lines
454 B
Go
package data
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
"git.fuyu.moe/5GPowerQuality/parser/internal/migrations"
|
|
"git.ultraware.nl/NiseVoid/qb/driver/autoqb"
|
|
"git.ultraware.nl/NiseVoid/qb/qbdb"
|
|
|
|
_ "github.com/lib/pq" // PostgreSQL driver
|
|
)
|
|
|
|
var db *qbdb.DB
|
|
|
|
func InitDB() {
|
|
d, err := sql.Open(`postgres`, `host=/tmp dbname=power_quality`)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
err = migrations.RunMigrations(d)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
db = autoqb.New(d)
|
|
|
|
}
|