website/pkg/models/models.go

51 lines
1.3 KiB
Go
Raw Permalink Normal View History

// 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{}, // ✔
2024-12-06 05:49:19 +00:00
&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{},
&Forum{},
// Vendor/misc data.
&WorldCities{},
)
}