2022-08-10 05:10:47 +00:00
|
|
|
// 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{})
|
2022-08-11 03:59:59 +00:00
|
|
|
DB.AutoMigrate(&ProfileField{})
|
2022-08-12 06:03:06 +00:00
|
|
|
DB.AutoMigrate(&Photo{})
|
2022-09-08 04:18:54 +00:00
|
|
|
DB.AutoMigrate(&PrivatePhoto{})
|
2022-08-13 22:39:31 +00:00
|
|
|
DB.AutoMigrate(&CertificationPhoto{})
|
2022-08-14 00:42:42 +00:00
|
|
|
DB.AutoMigrate(&Message{})
|
2022-08-14 05:44:57 +00:00
|
|
|
DB.AutoMigrate(&Friend{})
|
2022-08-15 00:45:55 +00:00
|
|
|
DB.AutoMigrate(&Block{})
|
2022-08-21 21:05:08 +00:00
|
|
|
DB.AutoMigrate(&Feedback{})
|
2022-08-24 05:55:19 +00:00
|
|
|
DB.AutoMigrate(&Forum{})
|
|
|
|
DB.AutoMigrate(&Thread{})
|
|
|
|
DB.AutoMigrate(&Comment{})
|
2022-08-25 04:17:34 +00:00
|
|
|
DB.AutoMigrate(&Like{})
|
|
|
|
DB.AutoMigrate(&Notification{})
|
2022-08-27 18:42:48 +00:00
|
|
|
DB.AutoMigrate(&Subscription{})
|
2022-10-21 04:02:30 +00:00
|
|
|
DB.AutoMigrate(&CommentPhoto{})
|
2022-12-15 06:57:06 +00:00
|
|
|
DB.AutoMigrate(&Poll{})
|
2022-12-21 03:15:45 +00:00
|
|
|
DB.AutoMigrate(&PollVote{})
|
2023-08-02 03:39:48 +00:00
|
|
|
DB.AutoMigrate(&AdminGroup{})
|
|
|
|
DB.AutoMigrate(&AdminScope{})
|
2023-08-20 02:11:33 +00:00
|
|
|
DB.AutoMigrate(&UserLocation{})
|
2023-09-16 20:46:26 +00:00
|
|
|
DB.AutoMigrate(&UserNote{})
|
2023-09-19 00:22:50 +00:00
|
|
|
DB.AutoMigrate(&TwoFactor{})
|
Change Logs
* 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
2024-02-26 01:03:36 +00:00
|
|
|
DB.AutoMigrate(&ChangeLog{})
|
2024-04-26 01:55:02 +00:00
|
|
|
DB.AutoMigrate(&IPAddress{})
|
2022-08-10 05:10:47 +00:00
|
|
|
}
|