开发者

Convert Ruby ActiveRecord Schema to SQL syntax

开发者 https://www.devze.com 2023-02-12 17:12 出处:网络
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开发者_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
0

精彩评论

暂无评论...
验证码 换一张
取 消