Ruby / Rails - Reverse Migration - DDL to Ruby Code
-
07-07-2019 - |
Question
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.
Solution
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow