Ruby / Rails - Reverse Migration - DDL to Ruby Code

时间秒杀一切 提交于 2019-12-06 09:37:05

问题


Any tools in Ruby or Rails that would allow me to extract from database all the table schema and generate Ruby equivalent "DLL" statements?

Something that would allow me to port schema from say Microsoft SQL Server to Postgres, or MySQL to Sqlite.


回答1:


In Rails/ActiveRecord, you can use rake db:schema:dump to generate db/schema.rb, and rake db:schema:load to load it into a database.



来源:https://stackoverflow.com/questions/1428499/ruby-rails-reverse-migration-ddl-to-ruby-code

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