parser/db.go
2018-05-07 14:07:37 +02:00

26 lines
400 B
Go

package main
import (
"database/sql"
"git.fuyu.moe/5GPowerQuality/parser/internal/migrations"
"git.ultraware.nl/NiseVoid/qb/driver/autoqb"
_ "github.com/lib/pq" // PostgreSQL driver
)
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)
}