mirror of
https://git.freecumextremist.com/grumbulon/pomme.git
synced 2024-11-23 01:33:46 +00:00
Not Sam
fe454dd2c7
Co-authored-by: Sam Therapy <sam@samtherapy.net> Reviewed-on: https://git.freecumextremist.com/grumbulon/pomme/pulls/1
19 lines
340 B
Go
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
|
|
}
|