revert: db transaction use, avoiding the pgx RETURNING issue while maintaining data consistency

This commit is contained in:
2025-11-21 16:31:06 +01:00
parent 34a97994b3
commit fa9474d863

View File

@@ -57,15 +57,10 @@ func HandleSeedCommand(cfg *config.Config, name string, args []string) error {
} }
return withDatabase(cfg, func(db *gorm.DB) error { return withDatabase(cfg, func(db *gorm.DB) error {
return db.Transaction(func(tx *gorm.DB) error { userRepo := repositories.NewUserRepository(db)
userRepo := repositories.NewUserRepository(db).WithTx(tx) postRepo := repositories.NewPostRepository(db)
postRepo := repositories.NewPostRepository(db).WithTx(tx) voteRepo := repositories.NewVoteRepository(db)
voteRepo := repositories.NewVoteRepository(db).WithTx(tx) return runSeedCommand(userRepo, postRepo, voteRepo, fs.Args())
if err := runSeedCommand(userRepo, postRepo, voteRepo, fs.Args()); err != nil {
return err
}
return nil
})
}) })
} }