f4d176a538
* Add a ChangeLog table to collect historic updates to various database tables. * Created, Updated (with field diffs) and Deleted actions are logged, as well as certification photo approves/denies. * Specific items added to the change log: * When a user photo is marked Explicit by an admin * When users block/unblock each other * When photo comments are posted, edited, and deleted * When forums are created, edited, and deleted * When forum comments are created, edited and deleted * When a new forum thread is created * When a user uploads or removes their own certification photo * When an admin approves or rejects a certification photo * When a user uploads, modifies or deletes their gallery photos * When a friend request is sent * When a friend request is accepted, ignored, or rejected * When a friendship is removed
36 lines
919 B
Go
36 lines
919 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{})
|
|
DB.AutoMigrate(&Poll{})
|
|
DB.AutoMigrate(&PollVote{})
|
|
DB.AutoMigrate(&AdminGroup{})
|
|
DB.AutoMigrate(&AdminScope{})
|
|
DB.AutoMigrate(&UserLocation{})
|
|
DB.AutoMigrate(&UserNote{})
|
|
DB.AutoMigrate(&TwoFactor{})
|
|
DB.AutoMigrate(&ChangeLog{})
|
|
}
|