Add migrations helper and refactor DB operations with environment variable support

This commit is contained in:
2025-05-10 22:18:38 +03:30
parent 0533151c1b
commit 5a897b5412
2 changed files with 15 additions and 16 deletions
+4
View File
@@ -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)