You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
299 B
15 lines
299 B
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{})
|
|
DB.AutoMigrate(&Post{})
|
|
DB.AutoMigrate(&TaggedPost{})
|
|
DB.AutoMigrate(&Comment{})
|
|
}
|
|
|