package models import ( "log" "gorm.io/gorm" "gorm.io/driver/sqlite" ) var ( DB *gorm.DB ) // Initializes the Gorm database object func Open() { // Initialize database object var err error DB, err = gorm.Open(sqlite.Open("data/blt.db"), &gorm.Config{}) if err != nil { panic("Failed to connect database") } // Migrate the schema DB.AutoMigrate(&Test{}, &Hardware{}, &Benchmark{}) log.Println("Database migrations complete.") }