gophertype/pkg/models/models.go
Noah ceb42aa4d0 Basic Commenting System Implemented
* List comments on a post
* Add comments, with preview
* Users can edit their own comments (EditToken)
* Admin can edit all comments
* Delete comments
* Comment counts on main blog index pages
2020-02-13 22:03:01 -08:00

16 lines
299 B
Go

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{})
}