pomme/internal/db/db.go
2022-12-30 18:04:44 +00:00

19 lines
340 B
Go

package db
import (
"git.freecumextremist.com/grumbulon/pomme/internal"
"github.com/glebarez/sqlite"
"gorm.io/gorm"
)
func InitDb() *gorm.DB {
db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{})
if err != nil {
panic("failed to connect database")
}
// Migrate the schema
db.AutoMigrate(&internal.User{})
return db
}