Cache migrated versions list in Migrator and use it to fetch the latest migrated version name [#845 state:resolved]
Cache migrated versions list in Migrator and use it to fetch the latest migrated version name [#845 state:resolved]

Also optimized Migrator#current_version class method to fetch
only the latest version number and not all of them.

With this change no matter how many migrations there are the
schema_migrations table is only SELECTed from once.

Signed-off-by: Jeremy Kemper <b3f594e10a9edcf5413cf1190121d45078c62290@bitsweat.net>

bolek/rails,marklocklear/rails,travisofthenorth/rails,lucasmazza/rails,flanger001/rails,mtsmfm/railstest,aditya-kapoor/rails,samphilipd/rails,aditya-kapoor/rails,gfvcastro/rails,Vasfed/rails,vipulnsward/rails,BlakeWilliams/rails,tgxworld/rails,printercu/rails,tgxworld/rails,riseshia/railsguides.kr,mechanicles/rails,arunagw/rails,odedniv/rails,Edouard-chin/rails,Erol/rails,Vasfed/rails,odedniv/rails,xlymian/rails,palkan/rails,rbhitchcock/rails,palkan/rails,ngpestelos/rails,arjes/rails,starknx/rails,riseshia/railsguides.kr,felipecvo/rails,arjes/rails,fabianoleittes/rails,tjschuck/rails,BlakeWilliams/rails,jeremy/rails,printercu/rails,maicher/rails,mtsmfm/railstest,assain/rails,esparta/rails,iainbeeston/rails,baerjam/rails,koic/rails,yahonda/rails,gavingmiller/rails,Spin42/rails,notapatch/rails,arunagw/rails,mechanicles/rails,eileencodes/rails,alecspopa/rails,lcreid/rails,felipecvo/rails,yasslab/railsguides.jp,gcourtemanche/rails,Envek/rails,kmcphillips/rails,fabianoleittes/rails,illacceptanything/illacceptanything,prathamesh-sonpatki/rails,illacceptanything/illacceptanything,Sen-Zhang/rails,assain/rails,bogdanvlviv/rails,tgxworld/rails,yhirano55/rails,sealocal/rails,vassilevsky/rails,betesh/rails,rossta/rails,bolek/rails,elfassy/rails,kachick/rails,untidy-hair/rails,amoody2108/TechForJustice,Vasfed/rails,alecspopa/rails,tjschuck/rails,yahonda/rails,alecspopa/rails,shioyama/rails,aditya-kapoor/rails,sergey-alekseev/rails,illacceptanything/illacceptanything,baerjam/rails,Stellenticket/rails,illacceptanything/illacceptanything,illacceptanything/illacceptanything,vipulnsward/rails,deraru/rails,vipulnsward/rails,odedniv/rails,EmmaB/rails-1,rossta/rails,repinel/rails,brchristian/rails,starknx/rails,Stellenticket/rails,mechanicles/rails,mohitnatoo/rails,brchristian/rails,kirs/rails-1,stefanmb/rails,mathieujobin/reduced-rails-for-travis,tijwelch/rails,gauravtiwari/rails,rails/rails,rafaelfranca/omg-rails,rails/rails,kamipo/rails,mijoharas/rails,shioyama/rails,MSP-Greg/rails,koic/rails,pvalena/rails,kaspth/rails,utilum/rails,mtsmfm/rails,xlymian/rails,yawboakye/rails,tjschuck/rails,arunagw/rails,rafaelfranca/omg-rails,felipecvo/rails,iainbeeston/rails,utilum/rails,richseviora/rails,betesh/rails,flanger001/rails,gauravtiwari/rails,palkan/rails,gcourtemanche/rails,rbhitchcock/rails,Sen-Zhang/rails,yhirano55/rails,Edouard-chin/rails,Sen-Zhang/rails,travisofthenorth/rails,notapatch/rails,prathamesh-sonpatki/rails,maicher/rails,gfvcastro/rails,mtsmfm/rails,bogdanvlviv/rails,aditya-kapoor/rails,assain/rails,rbhitchcock/rails,untidy-hair/rails,jeremy/rails,stefanmb/rails,bolek/rails,gauravtiwari/rails,yalab/rails,joonyou/rails,yawboakye/rails,riseshia/railsguides.kr,illacceptanything/illacceptanything,kddeisz/rails,deraru/rails,tgxworld/rails,schuetzm/rails,MichaelSp/rails,elfassy/rails,utilum/rails,iainbeeston/rails,yawboakye/rails,Erol/rails,kmcphillips/rails,bradleypriest/rails,samphilipd/rails,sergey-alekseev/rails,schuetzm/rails,elfassy/rails,Erol/rails,pvalena/rails,yalab/rails,kaspth/rails,ttanimichi/rails,richseviora/rails,untidy-hair/rails,yasslab/railsguides.jp,voray/rails,schuetzm/rails,jeremy/rails,sergey-alekseev/rails,palkan/rails,illacceptanything/illacceptanything,esparta/rails,kenta-s/rails,kmayer/rails,88rabbit/newRails,coreyward/rails,Spin42/rails,hanystudy/rails,amoody2108/TechForJustice,voray/rails,koic/rails,kachick/rails,mohitnatoo/rails,Envek/rails,ttanimichi/rails,gfvcastro/rails,bradleypriest/rails,Stellenticket/rails,shioyama/rails,Vasfed/rails,vassilevsky/rails,MichaelSp/rails,sealocal/rails,pvalena/rails,illacceptanything/illacceptanything,shioyama/rails,kddeisz/rails,yawboakye/rails,lcreid/rails,illacceptanything/illacceptanything,sealocal/rails,yhirano55/rails,baerjam/rails,MSP-Greg/rails,88rabbit/newRails,travisofthenorth/rails,arjes/rails,repinel/rails,gcourtemanche/rails,stefanmb/rails,flanger001/rails,Erol/rails,tijwelch/rails,eileencodes/rails,joonyou/rails,BlakeWilliams/rails,travisofthenorth/rails,pvalena/rails,xlymian/rails,fabianoleittes/rails,tijwelch/rails,yasslab/railsguides.jp,kirs/rails-1,kmayer/rails,eileencodes/rails,illacceptanything/illacceptanything,riseshia/railsguides.kr,MichaelSp/rails,lucasmazza/rails,betesh/rails,matrinox/rails,printercu/rails,fabianoleittes/rails,illacceptanything/illacceptanything,ngpestelos/rails,joonyou/rails,georgeclaghorn/rails,gavingmiller/rails,kmayer/rails,tjschuck/rails,pschambacher/rails,Edouard-chin/rails,untidy-hair/rails,bradleypriest/rails,yalab/rails,maicher/rails,deraru/rails,pschambacher/rails,flanger001/rails,hanystudy/rails,mijoharas/rails,samphilipd/rails,MSP-Greg/rails,yalab/rails,assain/rails,ngpestelos/rails,mechanicles/rails,prathamesh-sonpatki/rails,yahonda/rails,matrinox/rails,marklocklear/rails,georgeclaghorn/rails,voray/rails,kmcphillips/rails,jeremy/rails,matrinox/rails,yasslab/railsguides.jp,repinel/rails,mathieujobin/reduced-rails-for-travis,kmcphillips/rails,MSP-Greg/rails,Spin42/rails,notapatch/rails,illacceptanything/illacceptanything,kddeisz/rails,richseviora/rails,kamipo/rails,mtsmfm/railstest,bogdanvlviv/rails,georgeclaghorn/rails,lcreid/rails,Stellenticket/rails,notapatch/rails,88rabbit/newRails,lucasmazza/rails,ledestin/rails,mohitnatoo/rails,hanystudy/rails,amoody2108/TechForJustice,pschambacher/rails,esparta/rails,mathieujobin/reduced-rails-for-travis,EmmaB/rails-1,ledestin/rails,rails/rails,gfvcastro/rails,mijoharas/rails,mohitnatoo/rails,coreyward/rails,illacceptanything/illacceptanything,prathamesh-sonpatki/rails,coreyward/rails,marklocklear/rails,kamipo/rails,starknx/rails,kirs/rails-1,brchristian/rails,Envek/rails,Envek/rails,utilum/rails,kenta-s/rails,kddeisz/rails,vipulnsward/rails,vassilevsky/rails,Edouard-chin/rails,EmmaB/rails-1,ttanimichi/rails,yahonda/rails,rafaelfranca/omg-rails,rails/rails,kaspth/rails,schuetzm/rails,gavingmiller/rails,illacceptanything/illacceptanything,ledestin/rails,iainbeeston/rails,BlakeWilliams/rails,georgeclaghorn/rails,eileencodes/rails,betesh/rails,illacceptanything/illacceptanything,mtsmfm/rails,lcreid/rails,repinel/rails,rossta/rails,joonyou/rails,bogdanvlviv/rails,esparta/rails,printercu/rails,deraru/rails,yhirano55/rails,kachick/rails,kenta-s/rails,baerjam/rails,arunagw/rails