Noah
ceb42aa4d0
* 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
16 lines
299 B
Go
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{})
|
|
}
|