Last active
June 5, 2018 21:31
-
-
Save Cibernomadas/a4d0d2248c445706f2c1b24b6f017f55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package database | |
import ( | |
"log" | |
"github.com/cibernomadas/goblog/webapp/models" | |
"github.com/jinzhu/gorm" | |
_ "github.com/jinzhu/gorm/dialects/sqlite" | |
) | |
var DB *gorm.DB | |
func Init() *gorm.DB { | |
db, err := gorm.Open("sqlite3", "./data/goblog.db") | |
if err != nil { | |
log.Fatal(err) | |
} | |
db.AutoMigrate(&models.User{}) | |
return db | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment