欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

load migrate file and load

程序员文章站 2022-05-25 19:29:59
...
Dir[Rails.root.join('db','migrate','*.rb')].each{|file|require file}

Dir[File.dirname(__FILE__) + '/../lib/*.rb'].each do |file| 
  require File.basename(file, File.extname(file))
end


rails console
>> require "db/migrate/20090408054532_add_foos.rb"
>> AddFoos.up


script/runner 'require("db/migrate/20090408054532_add_foos.rb").first.constantize.up'


rake db:migrate:up VERSION=20090408054532