1

I 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?

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

2 Comments

Oh that sounds snazzy. I will try that and then I can do a dump from my database interface. Thanks.
Other rake:db commands might be helpful too, such as rake db:reset. A handy guide is at jacopretorius.net/2014/02/….

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.