Convert Ruby ActiveRecord Schema to SQL syntax
I开发者_JAVA技巧 haven't used Ruby much but I am trying to learn. I found a 'schema.db' file that looks like it is generated by Active Record module.
I am trying to figure out how do I convert this file into SQL so I can import it into my database?
Active Record does generate schema.rb and it represents the current state of the database (useful for getting a quick idea of what attributes each model has).
It is used when deploying new instances of an app, rather than replaying the whole migration history (and is also how the test database is created)
As an example, here's how you can deploy the production database:
RAILS_ENV=production rake db:create db:load
精彩评论