Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在将数据从 Rails 2 应用程序迁移到新的 Rails 3 应用程序。新数据库与旧数据库共享许多列,我希望将一些数据从旧数据库复制到新数据库。
我该怎么办?
如果是大量数据,我要做的是将您想要的数据转储到文件中,然后在单独的 rake 任务或 seed.rb 文件中执行以下操作:
sql = **read in your file*** ActiveRecord::Base.connection.execute(sql)