You could use this script to rename all your migrations with the new 
format.
I've used this chunk of code in a project (undeployed yet) to normalize 
the migrations names (01_, 02_ ... format and UTC format)
Maybe could be useful for you.

#!/usr/bin/env ruby

require 'find'
require 'fileutils'
require 'optparse'


# Create option parser.
options = {}
ARGV.options do |opts|
  opts.banner << " <path>"
  opts.on("-v", "--[no-]verbose", "run verbosely") do |v|
    options[:verbose] = v
  end

  opts.on("-l", "--[no-]local", "make local changes") do |v|
    options[:local] = v
  end

  opts.on("-s", "--[no-]subversion", "remane files on subversion") do |v|
    options[:subversion] = v
  end

  opts.on("-g", "--[no-]git", "remane files on git") do |v|
    options[:git] = v
  end

end.parse!

path = ARGV[0] or (STDERR.puts ARGV.options; exit 2)

printf "\033[1m\033[33mRename Ruby On Rails Migrations UTC (1 sec) 
\033[0m\n"
printf "\033[1m\033[33mbinoid 09/2008- we make webapps\033[0m\n"
sleep(2)

Dir.entries(path).sort.each do |old_name|
  if !File.directory?("#{path}/#{old_name}")
    new_name = old_name.gsub(/\d+/, Time.now.strftime("%Y%m%d%H%M%S"))

    puts ">> rename #{path + old_name} to #{path + new_name}\n" if 
options[:verbose]
    File.rename(path + old_name, path + new_name) if options[:local]
    system( "svn mv #{path + old_name} #{path + new_name}" ) if 
options[:subversion]
    system( "git-rename #{path + old_name} #{path + new_name}" ) if 
options[:git]
    sleep(1)
  end
end


(Sorry, I don't remember from where I copied this code)


Michael Satterwhite escribió:
> Frederick Cheung wrote:
>
>   
>> Do you also have a schema migrations table ? if so I'd try dropping
>> it. This is the replacement for the schema_info table, and should be
>> automatically created so that migrations are assumed to have run up to
>> the right point but might have got screwed up.
>>     
>
> Thanks much. That solved the problem.
>
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to