Rake is out of synch with my Database

元气小坏坏 提交于 2019-12-11 10:57:46

问题


I have inherited a Ruby on Rails project where the programmer didn't use rake to create the db schema, so it seems very out of synch, is there a way to rectify this?


回答1:


First create a schema.rb file

rake db:schema:dump

Then make a migration ot of it.

class CreateMigration < ActiveRecord::Migration
  def self.up
    # insert schema.rb here
  end

  def self.down
  end
end

You might also need to create the schema_migrations table, and manually add the timestamp for this migration to it.



来源:https://stackoverflow.com/questions/6220883/rake-is-out-of-synch-with-my-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!