52 lines
1.4 KiB
Go
52 lines
1.4 KiB
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 and user-generated data.
|
|
// ✔ = models are cleaned up on DeleteUser()
|
|
&AdminGroup{}, // ✔ admin_group_users
|
|
&Block{}, // ✔
|
|
&CertificationPhoto{}, // ✔
|
|
&ChangeLog{}, // ✔
|
|
&Comment{}, // ✔
|
|
&CommentPhoto{}, // ✔
|
|
&Feedback{}, // ✔
|
|
&ForumMembership{}, // ✔
|
|
&Friend{}, // ✔
|
|
&IPAddress{}, // ✔
|
|
&Like{}, // ✔
|
|
&Message{}, // ✔
|
|
&MutedUser{}, // ✔
|
|
&Notification{}, // ✔
|
|
&ProfileField{}, // ✔
|
|
&Photo{}, // ✔
|
|
&PollVote{}, // keep their vote on polls
|
|
&Poll{}, // vacuum script cleans up orphaned polls
|
|
&PrivatePhoto{}, // ✔
|
|
&PushNotification{}, // ✔
|
|
&Subscription{}, // ✔
|
|
&Thread{}, // ✔
|
|
&TwoFactor{}, // ✔
|
|
&UsageStatistic{}, // ✔
|
|
&User{}, // ✔
|
|
&UserLocation{}, // ✔
|
|
&UserNote{}, // ✔
|
|
|
|
// Non-user or persistent data.
|
|
&AdminScope{},
|
|
&DeletedUserMemory{},
|
|
&Forum{},
|
|
|
|
// Vendor/misc data.
|
|
&WorldCities{},
|
|
)
|
|
}
|