Noah
47f898561c
* Add support to upload a picture to forum posts and replies, in forums that have the PermitPhotos setting enabled. * New DB table: CommentPhoto holds the association between a photo and a forum ID. Photos can be uploaded at preview time (before a CommentID is available) and get associated to the CommentID on save. * Cron endpoint /v1/comment-photos/remove-orphaned can clean up orphaned photos without a CommentID older than 24 hours. * Add "Photo Boards" as a default forum category for new boards.
28 lines
681 B
Go
28 lines
681 B
Go
// Package models handles the database.
|
|
package models
|
|
|
|
import "gorm.io/gorm"
|
|
|
|
// DB to be set by calling app (SQLite or Postgres connection).
|
|
var DB *gorm.DB
|
|
|
|
// AutoMigrate the schema.
|
|
func AutoMigrate() {
|
|
DB.AutoMigrate(&User{})
|
|
DB.AutoMigrate(&ProfileField{})
|
|
DB.AutoMigrate(&Photo{})
|
|
DB.AutoMigrate(&PrivatePhoto{})
|
|
DB.AutoMigrate(&CertificationPhoto{})
|
|
DB.AutoMigrate(&Message{})
|
|
DB.AutoMigrate(&Friend{})
|
|
DB.AutoMigrate(&Block{})
|
|
DB.AutoMigrate(&Feedback{})
|
|
DB.AutoMigrate(&Forum{})
|
|
DB.AutoMigrate(&Thread{})
|
|
DB.AutoMigrate(&Comment{})
|
|
DB.AutoMigrate(&Like{})
|
|
DB.AutoMigrate(&Notification{})
|
|
DB.AutoMigrate(&Subscription{})
|
|
DB.AutoMigrate(&CommentPhoto{})
|
|
}
|