Files
plane/apps/monitor/cli/pkg/db/main.go
2025-07-03 01:55:24 +05:30

22 lines
349 B
Go

package db
import (
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
var Db *gorm.DB
// Initialize the database
func Initialize() error {
db, err := gorm.Open(sqlite.Open("monitor.db"), &gorm.Config{})
if err != nil {
return err
}
// Migrate all the changes to the db
db.AutoMigrate(&License{}, &UserLicense{}, &Flags{})
Db = db
return nil
}