mirror of
https://github.com/makeplane/plane.git
synced 2026-07-12 21:40:18 +02:00
22 lines
349 B
Go
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
|
||
|
|
}
|