Arthur Rats wrote:
Hi all I have a feature in a small app that creates the migration files needed from a small GUI it executes the rake task command to generate the migration files from inside a ruby script so I need to get a simple way to know what files havent been processed in the current migration compared to the db schema e.g. inside the db/migrate I count the files with something like Dir.glob("db/migrate/*").size then I get the current db version info with %x{rake.bat db:version}.split(' ').last.to_i then I compare the two values so that I can automatically execute from a controller %x{rake.bat db:migrate} #windows fix to add the .bat Is there an easier way to do this? Thanks Art
Why not just do the migration and let rails figure out what needs to be done. You are duplicating what rake db:migrate does.
Norm