Add migrations helper and refactor DB operations with environment variable support
This commit is contained in:
@@ -5,6 +5,10 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func AddMigrations(db *gorm.DB) {
|
||||
db.AutoMigrate(&models.Post{}, &models.MediaAttachment{}, &models.Account{})
|
||||
}
|
||||
|
||||
func GetExistingPostIds(db *gorm.DB) []string {
|
||||
var existingPostIds []string
|
||||
db.Model(&models.Post{}).Pluck("id", &existingPostIds)
|
||||
|
||||
Reference in New Issue
Block a user