colossus/models/init.go

17 lines
236 B
Go

package models
import (
"gorm.io/gorm"
"gorm.io/driver/sqlite"
)
var (
DB *gorm.DB
)
func InitDB() {
DB, _ = gorm.Open(sqlite.Open("data/colossus.db"), &gorm.Config{})
// Migrate the schema
DB.AutoMigrate(&Component{})
}