diff --git a/server/backend/migration/20240312000000.go b/server/backend/migration/20240312000000.go index 27ad2a87..2148d684 100644 --- a/server/backend/migration/20240312000000.go +++ b/server/backend/migration/20240312000000.go @@ -6,45 +6,45 @@ import ( ) // migrate20240212000000 -// remove unused ios notifications +// implemented a basic variant of spam protection func migrate20240212000000() *gormigrate.Migration { return &gormigrate.Migration{ ID: "20240212000000", Migrate: func(tx *gorm.DB) error { - if err := tx.Raw("alter table feedback modify email_id text charset utf8mb3 not null").Error; err != nil { + if err := tx.Exec("alter table feedback modify email_id text charset utf8mb3 not null").Error; err != nil { return err } - if err := tx.Raw("alter table feedback modify receiver text charset utf8mb3 not null").Error; err != nil { + if err := tx.Exec("alter table feedback modify receiver text charset utf8mb3 not null").Error; err != nil { return err } - if err := tx.Raw("alter table feedback modify feedback text charset utf8mb3 not null").Error; err != nil { + if err := tx.Exec("alter table feedback modify feedback text charset utf8mb3 not null").Error; err != nil { return err } - if err := tx.Raw("alter table feedback modify image_count int not null").Error; err != nil { + if err := tx.Exec("alter table feedback modify image_count int not null").Error; err != nil { return err } - if err := tx.Raw("alter table feedback modify timestamp datetime default current_timestamp() not null").Error; err != nil { + if err := tx.Exec("alter table feedback modify timestamp datetime default current_timestamp() not null").Error; err != nil { return err } - return tx.Raw("create unique index receiver_reply_to_feedback_app_version_uindex on feedback (receiver,reply_to,feedback,app_version)").Error + return tx.Exec("create unique index receiver_reply_to_feedback_app_version_uindex on feedback (receiver,reply_to,feedback,app_version)").Error }, Rollback: func(tx *gorm.DB) error { - if err := tx.Raw("alter table feedback modify email_id text charset utf8mb3 null").Error; err != nil { + if err := tx.Exec("alter table feedback modify email_id text charset utf8mb3 null").Error; err != nil { return err } - if err := tx.Raw("alter table feedback modify receiver text charset utf8mb3 null").Error; err != nil { + if err := tx.Exec("alter table feedback modify receiver text charset utf8mb3 null").Error; err != nil { return err } - if err := tx.Raw("alter table feedback modify feedback text charset utf8mb3 null").Error; err != nil { + if err := tx.Exec("alter table feedback modify feedback text charset utf8mb3 null").Error; err != nil { return err } - if err := tx.Raw("alter table feedback modify image_count int null").Error; err != nil { + if err := tx.Exec("alter table feedback modify image_count int null").Error; err != nil { return err } - if err := tx.Raw("alter table feedback modify timestamp datetime default current_timestamp() null").Error; err != nil { + if err := tx.Exec("alter table feedback modify timestamp datetime default current_timestamp() null").Error; err != nil { return err } - return tx.Raw("drop index receiver_reply_to_feedback_app_version_uindex on feedback").Error + return tx.Exec("drop index receiver_reply_to_feedback_app_version_uindex on feedback").Error }, } }