diff --git a/internal/legacy/migration.go b/internal/legacy/migration.go index d2cc54f1..7d667348 100644 --- a/internal/legacy/migration.go +++ b/internal/legacy/migration.go @@ -111,7 +111,7 @@ func (m *Migration) Do() error { }, } - if err := m.newStorage.SaveMessage(&message); err != nil { + if err := m.newStorage.DB.Create(&message).Error; err != nil { log.WithError(err).WithField("message_id", message.ID).Error("Unable to save message") continue } @@ -134,7 +134,7 @@ func (m *Migration) Do() error { IsSuperAdmin: oldUser.IsSuperAdmin, } - if err := m.newStorage.SaveUser(&user); err != nil { + if err := m.newStorage.DB.Create(&user).Error; err != nil { log.WithError(err).WithField("user_id", user.ID).Error("Unable to save user") continue } @@ -169,7 +169,7 @@ func (m *Migration) Do() error { ContentType: oldUpload.ContentType, } - if err := m.newStorage.SaveUpload(&upload); err != nil { + if err := m.newStorage.DB.Create(&upload).Error; err != nil { log.WithError(err).WithField("upload_id", upload.ID).Error("Unable to save upload") continue } diff --git a/internal/storage/migrations.go b/internal/storage/migrations.go index 55c2cacd..77e8bdfc 100644 --- a/internal/storage/migrations.go +++ b/internal/storage/migrations.go @@ -5,14 +5,14 @@ import "gorm.io/gorm" // MigrateDB migrates the database func MigrateDB(db *gorm.DB) error { return db.AutoMigrate( - &Attachment{}, - &Message{}, - &Setting{}, &Ticker{}, &TickerInformation{}, &TickerMastodon{}, &TickerTelegram{}, - &Upload{}, &User{}, + &Setting{}, + &Upload{}, + &Message{}, + &Attachment{}, ) }