From 7ac1a30a922d65296ec7b612fac43425542f8e72 Mon Sep 17 00:00:00 2001 From: Miguel Soriano Date: Mon, 21 Nov 2022 17:30:37 +0100 Subject: [PATCH] feat: reenable db prepared statements for kafka migrations the bug related to db prepared statements has been fixed on gorm.io/driver/postgres v1.4.5. We are now using that version so this reenables db prepared statements for kafka migrations --- internal/kafka/internal/migrations/migrations.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/internal/kafka/internal/migrations/migrations.go b/internal/kafka/internal/migrations/migrations.go index a7303abc9..3fef0a7e8 100644 --- a/internal/kafka/internal/migrations/migrations.go +++ b/internal/kafka/internal/migrations/migrations.go @@ -101,18 +101,7 @@ var migrations = []*gormigrate.Migration{ } func New(dbConfig *db.DatabaseConfig) (*db.Migration, func(), error) { - // We need to disable SQL Prepared Statements when performing Kafka DB - // migrations due to caching issues with them in gorm that end up causing - // errors. It seems the reasons for the issues might be a potential bug in - // gorm, as when using previous gorm versions (v1.21.7) the issues didn't - // happen. - // A GitHub issue has been opened to the gorm project - // reporting this: https://github.com/go-gorm/gorm/issues/5737 - // If it is confirmed to be an issue and gorm project fixes it we should - // update this code accordingly when the fix is applied. - dbConfigWithDisabledPreparedStatements := dbConfig.DeepCopy() - dbConfigWithDisabledPreparedStatements.EnablePreparedStatements = false - return db.NewMigration(dbConfigWithDisabledPreparedStatements, &gormigrate.Options{ + return db.NewMigration(dbConfig, &gormigrate.Options{ TableName: "migrations", IDColumnName: "id", IDColumnSize: 255,