gophertype/pkg/models/models.go

15 lines
271 B
Go
Raw Normal View History

2019-11-15 03:03:56 +00:00
package models
import "github.com/jinzhu/gorm"
// DB is the database handle for all the models.
var DB *gorm.DB
// UseDB registers a database driver.
func UseDB(db *gorm.DB) {
DB = db
DB.AutoMigrate(&User{})
2019-11-27 00:54:02 +00:00
DB.AutoMigrate(&Post{})
DB.AutoMigrate(&TaggedPost{})
2019-11-15 03:03:56 +00:00
}