package app import ( "code.lila.network/lauralani/tlm-login-server/internal/config" "code.lila.network/lauralani/tlm-login-server/internal/models" "github.com/glebarez/sqlite" //"gorm.io/driver/sqlite" with CGo "gorm.io/gorm" "log/slog" "os" ) func InitializeDB() error { var err error var db *gorm.DB db, err = gorm.Open(sqlite.Open(config.SQLitePath), &gorm.Config{}) if err != nil { slog.Error("Can't open DB", "path", config.SQLitePath) os.Exit(1) } models.DB = db err = models.DB.AutoMigrate(&models.User{}, &models.EmailConfirmation{}) if err != nil { slog.Error("Can't do DB Migration") return err } return nil }