package database import ( "fmt" "gorm.io/driver/sqlite" "gorm.io/gorm" ) // GCC Toolchain for Windows: https://jmeubank.github.io/tdm-gcc/ func migrateInitial(orm *gorm.DB) { err := orm.AutoMigrate(&User{}) if err != nil { fmt.Println(fmt.Errorf("failed to migrate User")) } } func (db *Database) Initialize() { orm, err := gorm.Open(sqlite.Open(db.Location), &gorm.Config{}) if err != nil { fmt.Println(fmt.Errorf("failed to connect Database")) } migrateInitial(orm) db.ORM = orm }